DHTMLX Docs & Samples Explorer

disableDays(mode, date)

Disables certain dates of each week, month or year.

Parameters:

  • mode - (“week”, “month” or “year”) defines the repetition period of the specified dates.
  • date - the date(s) you want to make inactive. If the date is set as a string, it should correspond to the format specified with the setDateFormat(format) method.

    myCalendar.disableDays("month",[1,2,5,6,19]); // disables 1st, 2nd, 5th, 6th and 19th day of each month

Description:

Different modes require different date formats:

  • week mode - numbers from 1 to 7. “1” relates to Monday, “7” - to Sunday.

    myCalendar.disableDays("week", 1); // disables every monday of each week in the calendar
    //or
    myCalendar.disableDays("week", [1, 2]); // disables every monday and tuesday of each week in the calendar 
  • month mode - numbers from 1 to 31. A number relates to the appropriate day of the month, e.g. '3' relates to the third day of a month.

    myCalendar.disableDays("month", 1); // disables 1st day of each month in the calendar
    //or
    myCalendar.disableDays("month", [1, 2]); // disables 1st and 2nd day of each month in the calendar 
  • year mode - date as a Date Object or as string in current date format.

    myCalendar.disableDays("year", "2011-01-01");// disables 1st January of each year in the calendar
    //or
    myCalendar.disableDays("year", ["2011-01-01", "2011-01-02"]); // disables 1st, 2nd January of each year in the calendar 

See also: