I'm using "daterangepicker" js to have a date range input in my web page.
Per the library documentation, it allows only to have 1 Custom Range. However, I need 2 Custom Ranges; one for picking dates ranges, and the other is to have "datepicker" to pick only a year.
Is there a way that could help me implementing that?
This is the code I have currently:
function cb (start, end) {
// what to show in the daterange input :
$('#reportrange span').html(start.format('YYYY/MM/DD') + ' - ' + end.format('YYYY/MM/DD'));
}
$('#reportrange').daterangepicker({
startDate: start,
endDate: end,
ranges: {
'This Month': [moment().startOf('month'), moment().endOf('month')]
,'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
,'This Week': [moment().startOf('week'), moment().endOf('week')]
,'Last Week': [moment().subtract(1, 'week').startOf('week'), moment().subtract(1, 'week').endOf('week')]
},
showCustomRangeLabel: true
}, cb);
cb(start, end);
I tried to add to daterangepicker:
"locale": { "customRangeLabel": "Select Year"}
so I can use the "datepicker" with year format in this item, but this only overwrote the title of the "Custom Range" that I have already to be "Select Year".
Thanks in advance.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…