When you add a Calendar to an application, you need to specify its value in one of the following formats:
The number of milliseconds since 00:00:00 on January 1, 1970
Strings that match the following patterns:
This demo shows how to use additional properties to customize your Calendar. You can toggle the checkboxes on the right to change the Calendar in real time.
Use the min and max properties to specify the range of available dates. In this demo, these properties limit the range to three days before and after the current date. Enable the "Set minimum date" and "Set maximum date" checkboxes to apply the properties.
If you need to disable specific dates, use the disabledDates property. Toggle the "Disable weekends" checkbox to see how this setting affects the component's behavior. You can specify either an array of predefined dates or a function that determines whether a date is available.
To specify the first day of the week, assign its index (0 - for Sunday, 1 - for Monday, and so on) to the firstDayOfWeek property. You can also display a column with week numbers. For this, enable the showWeekNumbers property.
The start of the first week of the year depends on the locale. If you want to apply a specific rule, use the weekNumberRule property.
Set the onValueChanged property to handle the value change. In this demo, the DateBox and the Calendar both use this property to pass values between each other, and you can use one of these components to change the date.
Use the cellTemplate property to customize cell appearance. In this demo, the following customizations are applied when you toggle the "Use custom cell template" checkbox:
All the weekends on the Calendar become blue.
All the holidays become red.
If a column with week numbers is shown, week numbers are italicized.
You can set your own function that changes the class of the span element that contains cell text.
Set the disabled property to disable the Calendar.
To specify the initial calendar view (month, year, decade, or century), set the zoomLevel property.