Setting days off with the Datepicker
I am using the Jquery Datepicker but cannot figure out the code to set Sundays and certain other days (bank holidays) as non-selectable.
It's the second part of the code that should be setting these 'days off' but when using the code above all days are available.
Any ideas?!?!?
<script>
$(function() {
$('#date1').datepicker({dateFormat: 'dd/mm/yy'});
setMinDate(); // Set it now
setInterval(setMinDate, 60000); // And check every minute
});
function setMinDate() {
var minDate = new Date();
minDate.setDate(minDate.getDate()+(minDate.getHours() < 13 ? 1 : 2));
$('#date1').datepicker('option', {minDate: minDate, defaultDate: minDate});
}
function nonWorkingDates(date){
var day = date.getDay(), Sunday = 0, Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6;
var closedDates = [[7, 29, 2011], [8, 25, 2011]];
var closedDays = [Sunday];
for (var i = 0; i < closedDays.length; i++) {
if (day == closedDays[i][0]) {
return [false];
}
}
;
}
</script>