Your search did not match any results.


When you add a Calendar to an application, you need to specify its value in one of the following formats:

  • Date objects

  • The number of milliseconds since 00:00:00 on January 1, 1970

  • Strings that match the following patterns:

    • 'yyyy-MM-dd'
    • 'yyyy-MM-ddTHH:mm:ss'
    • 'yyyy-MM-ddTHH:mm:ssZ'
    • 'yyyy-MM-ddTHH:mm:ssx'

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.

Disable Dates

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.

Specify First Day of Week and Display Week Numbers

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.

Handle Value Change

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.

Customize Cell Appearance

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.

Other Customizations

Set the disabled property to disable the Calendar.

To specify the initial calendar view (month, year, decade, or century), set the zoomLevel property.

Backend API
Copy to CodePen
window.onload = function () { const zoomLevels = ['month', 'year', 'decade', 'century']; const holidays = [[1, 0], [4, 6], [25, 11]]; const useCellTemplate = ko.observable(false); const disableWeekend = ko.observable(false); const cellTemplate = ko.computed(() => { if (useCellTemplate()) { return getCellTemplate; } return 'cell'; }); const disabledDates = ko.computed(() => { if (disableWeekend()) { return isDateDisabled; } return null; }); const viewModel = { now: new Date(), zoomLevels, currentValue: ko.observable(new Date()), calendarDisabled: ko.observable(false), isMondayFirst: ko.observable(false), useMinDate: ko.observable(false), useMaxDate: ko.observable(false), disableWeekend, disabledDates, zoomLevel: ko.observable(zoomLevels[0]), cellTemplate, useCellTemplate, }; function isWeekend(date) { const day = date.getDay(); return day === 0 || day === 6; } function getCellTemplate(data) { let cssClass = ''; if (isWeekend( { cssClass = 'weekend'; } $.each(holidays, (_, item) => { if ( === item[0] && === item[1]) { cssClass = 'holiday'; return false; } return true; }); return `<span class='${cssClass}'>${data.text}</span>`; } function isDateDisabled(data) { return data.view === 'month' && isWeekend(; } ko.applyBindings(viewModel, document.getElementById('calendar-demo')); };
<!DOCTYPE html> <html xmlns=""> <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> <script src=""></script> <script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script> <script src=""></script> <link rel="stylesheet" type="text/css" href="" /> <script src=""></script> <link rel="stylesheet" type="text/css" href="styles.css" /> <script src="index.js"></script> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="calendar-demo"> <div class="widget-container"> <div id="calendar-container" data-bind="dxCalendar: { value: currentValue, min: useMinDate() ? (new Date(now.getTime() - 1000*60*60*24*3)) : undefined, max: useMaxDate() ? (new Date(now.getTime() + 1000*60*60*24*3)) : undefined, disabledDates: disabledDates, disabled: calendarDisabled, cellTemplate: cellTemplate, firstDayOfWeek: isMondayFirst() ? 1 : 0, zoomLevel: zoomLevel }"></div> </div> <div class="options"> <div class="caption">Options</div> <div class="option"> <div data-bind="dxCheckBox: { value: useMinDate, text: 'Specify min value', }"></div> </div> <div class="option"> <div data-bind="dxCheckBox: { value: useMaxDate, text: 'Specify max value', }"></div> </div> <div class="option"> <div data-bind="dxCheckBox: { value: disableWeekend, text: 'Disable weekend', }"></div> </div> <div class="option"> <div data-bind="dxCheckBox: { text: 'Monday as the first day of a week', value: isMondayFirst }"></div> </div> <div class="option"> <div data-bind="dxCheckBox: { text: 'Use custom cell template', value: useCellTemplate }"></div> </div> <div class="option"> <div data-bind="dxCheckBox: { text: 'Disabled', value: calendarDisabled }"></div> </div> <div class="option"> <span>Zoom level</span> <div id="zoom-level" data-bind="dxSelectBox: { dataSource: zoomLevels, value: zoomLevel }"></div> </div> <div class="option"> <span>Selected date</span> <div id="selected-date" data-bind="dxDateBox: { value: currentValue, width: '100%' }"></div> </div> </div> </div> </div> </body> </html>
.widget-container { margin-right: 320px; } #calendar-container { margin: auto; } .dx-calendar-cell:not(.dx-calendar-other-month) .weekend, .dx-calendar-cell:not(.dx-calendar-other-month) .holiday { text-shadow: none; font-weight: bold; } .dx-calendar-cell:not(.dx-calendar-other-month) .weekend { color: #3030ff; } .dx-state-disabled.dx-calendar .dx-calendar-cell:not(.dx-calendar-other-month) .weekend { color: #8080ff; } .dx-calendar-cell:not(.dx-calendar-other-month) .holiday { color: #ff3030; } .dx-state-disabled.dx-calendar .dx-calendar-cell:not(.dx-calendar-other-month) .holiday { color: #ff8080; } .options { padding: 20px; background-color: rgba(191, 191, 191, 0.15); position: absolute; right: 0; top: 0; bottom: 0; width: 260px; } .caption { font-weight: 500; font-size: 18px; } .option { margin-top: 10px; }