I am using a jQuery UI Datepicker, such that only Sunday can be selected.
What I would like to happen is have it where no dates from the current date into the future can be selected. Here is the code I am using currently:
var daysToDisable = [1,2,3,4,5,6];
$('#startdate').datepicker({
beforeShowDay: disableSpecificWeekDays
});
function disableSpecificWeekDays(date) {
var day = date.getDay();
for (i = 0; i < daysToDisable.length; i++) {
if ($.inArray(day, daysToDisable) != -1) {
return [false];
}
}
return [true];
}
You can use the maxDate property to prevent the selection of future dates.
Note: this assumes your dateFormat is dd/mm/yy
Edit: http://jsfiddle.net/jXGZz/
Modified twoDigitMonth