Is there any (easy) way to set the jQuery UI Datepicker to disallow selection of specific, predetermined days?
I was able to get this approach working, however, it p
You can use the beforeShowDay option. I needed to disable any day past the 28th of the month. Here is my code.
$('.datepicker').datepicker({
dateFormat: "yy-mm-dd",
beforeShowDay: function(date) {
var day = date.getDate();
if (day > 28) {
return [false];
} else {
return [true];
}
}
});
Here is more information about it: http://api.jqueryui.com/datepicker/#option-beforeShowDay
The date variable passed into the beforeShowDay callback is a JavaScript date object, so it can be formatted using various libraries, a timestamp can be retrieved using date.getTime(), etc.