This demo shows how to disable specific days, dates, and times when a user cannot schedule an appointment. In the demo, appointments are disabled for weekends, certain individual dates (e.g., May 25th), and the time period from 12:00pm to 1:00pm.
To implement this functionality in your application, follow the steps below:
Implement custom date/time validation functions
These functions should check whether a date or time is available. This demo includes the date/time validation functions listed below. In your application, they can be different.
isValidAppointment
isValidAppointmentInterval
isValidAppointmentDate
isHoliday
, isWeekend
, and isDinner
functions.isHoliday
/ isWeekend
/ isDinner
Validate appointments before they are created or updated
Before an appointment is created or updated, the Scheduler executes the onAppointmentAdding and onAppointmentUpdating functions. Use them to start validation. If a date or time is invalid, cancel
the creation or update. Implement the same logic in the onAppointmentFormOpening function so that users cannot open the appointment details form for a disabled date or time.
Customize the appointment details form
The appointment details form includes two calendars that allow users to select an appointment's start and end date/time. You should also disable dates in these calendars. Review the applyDisableDatesToDateEditors
function to see how this is done. Call this function from onAppointmentFormOpening.
Customize the timetable appearance
Use templates to customize the appearance of data cells (dataCellTemplate), time cells (timeCellTemplate), and date cells (dateCellTemplate). In this demo, date cell customization is visible only in the Month view. To switch to this view, use the view switcher in the Scheduler's upper right corner.