DHTMLX Docs & Samples Explorer

Disabling in year mode

disable each January 1st
disable each January 1st and 2nd
disable each January 1st, 2nd, 3rd, 14th and 15th
disable each December 30th, 31st, January 1st, 2nd
clear disabled days
Source
<link rel="stylesheet" type="text/css" href="../../codebase/dhtmlxcalendar.css">
    <link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxcalendar_dhx_skyblue.css">
    <script src="../../codebase/dhtmlxcalendar.js"></script>
    <script>
var myCalendar;
function doOnLoad() {
    myCalendar = new dhtmlXCalendarObject("calendarHere");
    myCalendar.hideTime();
    myCalendar.show();
    myCalendar.setDate("2011-01-17");
}
function enableDays() {
    myCalendar.enableDays("year");
}
function disableDays(d) {
    myCalendar.disableDays("year", d);
}
</script> <div style="margin-bottom: 20px;"> <table> <tr> <td><input type="button" value="apply" onclick="disableDays('2011-01-01');"></td> <td>disable each January 1st</td> </tr> <tr> <td><input type="button" value="apply" onclick="disableDays(['2011-01-01','2011-01-02']);"></td> <td>disable each January 1st and 2nd</td> </tr> <tr> <td><input type="button" value="apply" onclick="disableDays(['2011-01-01','2011-01-02','2011-01-03','2011-01-14','2011-01-15']);"></td> <td>disable each January 1st, 2nd, 3rd, 14th and 15th</td> </tr> <tr> <td><input type="button" value="apply" onclick="disableDays(['2011-12-30','2011-12-31','2011-01-01','2011-01-02']);"></td> <td>disable each December 30th, 31st, January 1st, 2nd</td> </tr> <tr> <td><input type="button" value="apply" onclick="enableDays();"></td> <td>clear disabled days</td> </tr> </table> </div> <div id="calendarHere" style="position:relative;height:250px;"></div>