Hi,
I am using the default date picker, but I want to limit the date picker to only show 'This Month' and 'Last Month' options and hide the rest. How can I achieve this?
I have tried the following script that was discussed in another forum, but it did not work:
<script type="text/javascript">
$(document).ready(function() {
// Define custom date ranges
var customRanges = {
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
};
// Apply the custom ranges to the date picker
$('#u3').daterangepicker({
ranges: customRanges,
locale: {
format: 'YYYY-MM-DD'
}
});
});
</script>
Can you please assist with this issue? Thank you!