Skip to content

Instantly share code, notes, and snippets.

@miahsuwork
Last active January 10, 2020 03:22
Show Gist options
  • Save miahsuwork/f975b1593c119b659605fb0c8dcd696f to your computer and use it in GitHub Desktop.
Save miahsuwork/f975b1593c119b659605fb0c8dcd696f to your computer and use it in GitHub Desktop.
$('input[name="dates"]').daterangepicker({
ranges: {
'今天': [moment(), moment()],
'昨天': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'前 7 天': [moment().subtract(6, 'days'), moment()],
'前 30 天': [moment().subtract(29, 'days'), moment()],
'這個月': [moment().startOf('month'), moment().endOf('month')],
'上個月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
},
"locale": {
"format": "YYYY年MM月DD日",
"separator": " - ",
"applyLabel": "確認",
"cancelLabel": "取消",
"customRangeLabel": "自訂義範圍",
"daysOfWeek": [
"日",
"一",
"二",
"三",
"四",
"五",
"日"
],
"monthNames": [
"1 月",
"2 月",
"3 月",
"4 月",
"5 月",
"6 月",
"7 月",
"8 月",
"9 月",
"10 月",
"11 月",
"12 月"
],
"firstDay": 1
},
"startDate": "2019年06月06日",
"endDate": "2019年06月09日",
"minDate": "2000年01月02日",
"maxDate": "2020年12月31日"
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment