Calendar

The Calendar is a widget that displays a calendar and allows an end user to select the required date within a specified date range.

Included in: dx.mobile.js, dx.web.js, dx.viz-web.js, dx.all.js
Module: ui/calendar
Export: default
Calendar interactive configuration
Copy Code
Copy to Codepen
$("#calendar").dxCalendar({
});

                    

DevExtreme widgets are integrated with many popular libraries and frameworks. See the Installation section (for JavaScript libraries) or the Prerequisites and Installation section (for ASP.NET MVC framework) to find details on setting up DevExtreme with a particular library or framework.

The following code shows how to create the Calendar widget using every supported library and framework. For more details on working with widgets in these libraries and frameworks, see the Widget Basics topic for jQuery, Angular, AngularJS, Knockout or ASP.NET MVC.

jQuery
JavaScript
HTML
$(function () {
    $("#calendar").dxCalendar({
        min: new Date(2000, 1, 1),
        max: new Date(2029, 12, 31),
        firstDayOfWeek: 1,
        value: new Date()
    });
});
<div id="calendar"></div>
Angular
HTML
TypeScript
<dx-calendar
    [min]="minDate"
    [max]="maxDate"
    [firstDayOfWeek]="1"
    [(value)]="currentDate">
</dx-calendar>
import { DxCalendarModule } from 'devextreme-angular';
// ...
export class AppComponent {
    minDate = new Date(2000, 0, 1);
    maxDate = new Date(2029, 11, 31);
    currentDate = new Date();
}
@NgModule({
    imports: [
        // ...
        DxCalendarModule
    ],
    // ...
})
AngularJS
HTML
JavaScript
<div ng-controller="DemoController">
    <div dx-calendar="{
        min: minDate,
        max: maxDate,
        firstDayOfWeek: 1,
        bindingOptions: {
            value: 'currentDate'
        }
    }"></div>
</div>
angular.module('DemoApp', ['dx'])
    .controller("DemoController", function ($scope) {
        $scope.minDate = new Date(2000, 0, 1);
        $scope.maxDate = new Date(2029, 11, 31);
        $scope.currentDate = new Date();
    });
Knockout
HTML
JavaScript
<div data-bind="dxCalendar: {
    min: new Date(2000, 1, 1),
    max: new Date(2029, 12, 31),
    firstDayOfWeek: 1,
    value: currentDate
}"></div>
var viewModel = {
    currentDate: ko.observable(new Date())
};
ko.applyBindings(viewModel);
ASP.NET MVC Controls
Razor C#
Razor VB
@(Html.DevExtreme().Calendar()
    .ID("calendar")
    .Min(new DateTime(2000, 1, 1))
    .Max(new DateTime(2029, 12, 31))
    .FirstDayOfWeek(FirstDayOfWeek.Monday)
    .Value(DateTime.Now)
)
@(Html.DevExtreme().Calendar() _
    .ID("calendar") _
    .Min(New DateTime(2000, 1, 1)) _
    .Max(New DateTime(2029, 12, 31)) _
    .FirstDayOfWeek(FirstDayOfWeek.Monday) _
    .Value(DateTime.Now)
)

View Demo Watch Video

See Also
Show Example:
AngularJS
Knockout
jQuery

Configuration

An object defining configuration options for the Calendar widget.

Methods

This section describes the members used to manipulate the widget.

Events

This section describes events that this widget raises.

See Also

Default Cell Template

This section lists the fields that are used in a default template for calendar cells.

Type:

Object

By default, a predefined cell template is applied to display calendar cells. This template is based on certain fields of an object holding cell information. Below is the list of these fields. If the default cell template is not appropriate for your task, implement a custom cell template based on these fields.

See Also