Here is how you can do it ...
Getting the last day for a given year and month:
function getLastDayOfYearAndMonth(year, month)
{
return(new Date((new Date(year, month + 1, 1)) - 1)).getDate();
}
Pay attention to the beforeShowDayevent if the date is the last month:
$('.selector').datepicker(
{
beforeShowDay: function(date)
{
if (date.getDate() ==
getLastDayOfYearAndMonth(date.getFullYear(), date.getMonth()))
{
return [true, ''];
}
return [false, ''];
}
});
source
share