26 lines
1.1 KiB
JavaScript
26 lines
1.1 KiB
JavaScript
$('.daterange-custom-picker').daterangepicker({
|
|
"showDropdowns": true,
|
|
ranges: {
|
|
'Today': [moment(), moment()],
|
|
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
|
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
|
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
|
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
|
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
|
},
|
|
"linkedCalendars": false,
|
|
"autoUpdateInput": false,
|
|
"alwaysShowCalendars": true,
|
|
"cancelClass": "btn-danger"
|
|
}, function (start, end, label) {
|
|
// console.log('New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') +
|
|
// ' (predefined range: ' + label + ')');
|
|
});
|
|
|
|
$('.daterange-custom-picker').on('apply.daterangepicker', function (ev, picker) {
|
|
$(this).val(picker.startDate.format('YYYY-MM-DD') + ' to ' + picker.endDate.format('YYYY-MM-DD'));
|
|
});
|
|
|
|
$('.daterange-custom-picker').on('cancel.daterangepicker', function (ev, picker) {
|
|
$(this).val('');
|
|
}); |