Skip to main content

beforeChange

fires before the change of date selection

beforeChange: (date: Date, oldDate: Date, byClick: boolean) => boolean | void;

Parameters:

  • date: Date - the newly selected date
  • oldDate: Date - the previously selected date
  • byClick: boolean - defines whether the change happened because of a click on a date - true, or due to an API call - false

Returns:

Return true to allow changing date selection, false to prevent changing date selection.

Example

calendar.events.on("beforeChange",function(date, oldDate, byClick){
if (date > new Date())
return false;
});

Related sample: Calendar. Events

You can block selection of particular dates by returning false from the event handler.