Disabled Dates

The Calendar allows you to disable the selection of specified dates by providing a disabledDates value to the component.

The Calendar supports the following approaches for disabling dates:

  • Using a functionThe format for this input is (date: Date) => boolean. The approach disables each date for which the provided function returns true.
  • Using an array of datesThe format for this input is Date[]. The approach disables only the dates that are explicitly listed.
  • Using an array of daysThe format for this input is Day[]. The approach disables the specified days of the week.

Using a Function

The following example demonstrates how to provide a function to disable every even date in the Calendar.

Example
View Source
Edit In Stackblitz  
Change Theme:

Using a Date Array

The following example demonstrates how to provide an array of dates to disable the listed dates.

@Component({
  selector: 'my-app',
  template: `
    <kendo-calendar
      [value]="value"
      [disabledDates]="disabledDates"
    >
    </kendo-calendar>
  `
})
class AppComponent {
  public value: Date = new Date(2019, 5, 5);

  public disabledDates: Date[] = [
    new Date(2019, 5, 1),
    new Date(2019, 5, 2),
    new Date(2019, 5, 3),
    new Date(2019, 5, 4),
    new Date(2019, 5, 9),
    new Date(2019, 5, 12),
    new Date(2019, 5, 22)
  ];
}

Using a Day Array

The following example demonstrates how to provide an array of Day enum values to disable the listed days of the week, that is, the days of the weekend.

import { Day } from '@progress/kendo-date-math';

@Component({
  selector: 'my-app',
  template: `
    <kendo-calendar
      [disabledDates]="disabledDates"
    >
    </kendo-calendar>
  `
})
class AppComponent {
  public disabledDates: Day[] = [Day.Saturday, Day.Sunday];
}

In this article

Not finding the help you need?