DateBox

The DateBox is a widget that displays date and time in a specified format, and enables a user to pick or type in the required date/time value.

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

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

jQuery
JavaScript
HTML
$(function () {
    $("#dateBox").dxDateBox({
        min: new Date(2000, 0, 1),
        max: new Date(2029, 11, 31),
        value: new Date()
    });
});
<div id="dateBox"></div>
Angular
HTML
TypeScript
<dx-date-box
    [min]="minDate"
    [max]="maxDate"
    [(value)]="currentDate">
</dx-date-box>
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-date-box="{
        min: minDate,
        max: maxDate,
        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="dxDateBox: {
    min: new Date(2000, 0, 1),
    max: new Date(2029, 11, 31),
    value: currentDate
}"></div>
var viewModel = {
    currentDate: ko.observable(new Date())
};
ko.applyBindings(viewModel);
ASP.NET MVC Controls
Razor C#
Razor VB
@(Html.DevExtreme().DateBox()
    .ID("dateBox")
    .Min(new DateTime(2000, 1, 1))
    .Max(new DateTime(2029, 12, 31))
    .Value(DateTime.Now)
)
@(Html.DevExtreme().DateBox() _
    .ID("dateBox") _
    .Min(New DateTime(2000, 1, 1)) _
    .Max(New DateTime(2029, 12, 31)) _
    .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

See Also
Show Example:
AngularJS
Knockout
jQuery

Configuration

An object defining configuration options for the DateBox widget.

Methods

This section describes members used to manipulate the widget.

Events

This section describes events fired by this widget.

See Also