|
|
|
@ -18,6 +18,14 @@ $(function () { |
|
|
|
function cb(start, end) { |
|
|
|
$('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY')); |
|
|
|
} |
|
|
|
|
|
|
|
function getRanges() { |
|
|
|
return { |
|
|
|
'Today': [moment(), moment()], |
|
|
|
'Tomorow': [moment().add(1, 'days'), moment().add(1, 'days')], |
|
|
|
'Next 7 Days': [moment(), moment().add(6, 'days')], |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
var when = $("#WhenInput"); |
|
|
|
if (minDate !== null && maxDate !== null && minDate.length > 0 && maxDate.length > 0){ |
|
|
|
@ -31,13 +39,7 @@ $(function () { |
|
|
|
locale: { |
|
|
|
cancelLabel: 'Clear' |
|
|
|
}, |
|
|
|
ranges: { |
|
|
|
'Today': [moment(), moment()], |
|
|
|
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')], |
|
|
|
'Last 7 Days': [moment().subtract(6, 'days'), moment()], |
|
|
|
'This Month': [moment().startOf('month'), moment().endOf('month')], |
|
|
|
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')] |
|
|
|
} |
|
|
|
ranges: getRanges() |
|
|
|
}, cb); |
|
|
|
}else { |
|
|
|
when.daterangepicker({ |
|
|
|
@ -45,14 +47,7 @@ $(function () { |
|
|
|
locale: { |
|
|
|
cancelLabel: 'Clear' |
|
|
|
}, |
|
|
|
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')] |
|
|
|
} |
|
|
|
ranges: getRanges() |
|
|
|
}, cb); |
|
|
|
} |
|
|
|
|
|
|
|
|