I want to get the last day of the month using daterangepicker.
Here is my script:
$('input[name="enddate"]').daterangepicker({
singleDatePicker: true,
showDropdowns: true,
isInvalidDate: function( date ) {
if( date.date() === getLastDayOfYearAndMonth(date.getFullYear(), date.getMonth()) ) {
return false;
} else {
return true;
}
},
locale: {
format: 'DD-MMM-YY'
}
});
function getLastDayOfYearAndMonth(year, month) {
return(new Date((new Date(year, month + 1, 1)) - 1)).getDate();
}