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({
});

You can create the widget using one of the following approaches.

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
JavaScript
<dx-calendar
    [min]="minDate"
    [max]="maxDate"
    [firstDayOfWeek]="1"
    [(value)]="currentDate">
</dx-calendar>
export class AppComponent {
    minDate = new Date(2000, 0, 1);
    maxDate = new Date(2029, 11, 31);
    currentDate = new Date();
}
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)
)

Note that DevExtreme widgets require you to link the jQuery library to your application. If you use the Knockout or AngularJS approach, the Knockout or AngularJS library is also required. For detailed information on linking these libraries to your project, refer to the topics in the Installation section.

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 members used to manipulate the widget.

Events

This section describes events fired by this widget.

See Also

Default Cell Template

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

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