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

    HTML
    <div id="dateBox"></div>
    JavaScript
    $(function () {
        $("#dateBox").dxDateBox({
            min: new Date(2000, 0, 1),
            max: new Date(2029, 11, 31),
            value: new Date()
        });
    });
  • AngularJS

    HTML
    <div ng-controller="DemoController">
        <div dx-date-box="{
            min: minDate,
            max: maxDate,
            bindingOptions: {
                value: 'currentDate'
            }
        }"></div>
    </div>
    JavaScript
    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
    <div data-bind="dxDateBox: {
        min: new Date(2000, 0, 1),
        max: new Date(2029, 11, 31),
        value: currentDate
    }"></div>
    JavaScript
    var viewModel = {
        currentDate: ko.observable(new Date())
    };
    ko.applyBindings(viewModel);
  • ASP.NET MVC Wrappers

    @(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.