Модифицируя вышеуказанный код, для использования с разными днями в разные годы, вы можете использовать ...
<script>
//holidays
var natDays = [
[11,1,2012, 'mx'],[11,2,2012, 'mx'],[11,19,2012, 'mx'],
[12, 12, 2012, 'mx'],[12,20,2012, 'mx'],[12,25,2012, 'mx'],[12,31,2012, 'mx'],
[1,2,2013, 'mx'],[1,3,2013, 'mx'],[1, 4, 2013, 'mx'],[1,1,2014, 'mx'],[1,2,2014, 'mx']
];
var dateMin = new Date();
var weekDays = AddBusinessDays(3);
dateMin.setDate(dateMin.getDate() + weekDays);
function AddBusinessDays(weekDaysToAdd) {
var curdate = new Date();
var realDaysToAdd = 0;
while (weekDaysToAdd > 0){
curdate.setDate(curdate.getDate()+1);
realDaysToAdd++;
//check if current day is business day
if (noWeekendsOrHolidays(curdate)[0]) {
weekDaysToAdd--;
}
}
return realDaysToAdd;
}
function noWeekendsOrHolidays(date) {
var noWeekend = $.datepicker.noWeekends(date);
if (noWeekend[0]) {
return nationalDays(date);
} else {
return noWeekend;
}
}
function nationalDays(date) {
for (i = 0; i < natDays.length; i++) {
if (date.getMonth() == natDays[i][0] - 1 && date.getDate() == natDays[i][1] && date.getFullYear() == natDays[i][2]) {
return [false, '', 'No laboral ' + natDays[i][3]+'']; /* 'Holiday in ' + natDays[i][3] */
}
}
return [true, ''];
}
$(function() {
$( "#datepicker" ).datepicker({
beforeShowDay: noWeekendsOrHolidays,
altField: '#FI',
dateFormat: "dd/mm/yy",
defaultDate: '-0y',
changeMonth: true,
changeYear: true,
minDate: new Date(2012, 1 - 1, 5),
//minDate: "-1Y",
maxDate: "0Y",
showWeek: true,
firstDay: 0,
showOn: "both",
buttonImage: "images/calendar.gif",
buttonText: "Seleccionar Fecha", /*Select date text */
buttonImageOnly: true,
});
$(this).focus();
});
</script>