Your search did not match any results.

Date Box

The DateBox is a widget that displays the date and time in one of DevExtreme predefined formats or a format defined in an external localization library, or a type in the required date/time value. In this demo, the «Custom format» DateBox’es value is formatted using the Globalize library. Alternatively, you can use Intl.
Copy to CodePen
window.onload = function() { var now = new Date(), eventDateBoxValue = ko.observable(new Date(1981, 3, 27)); var viewModel = { dateFormat: { type: "date", value: now }, timeFormat: { type: "time", value: now }, dateTimeFormat: { type: "datetime", value: now }, customFormat: { displayFormat: "EEEE, MMM dd", value: now }, dateByPicker: { pickerType: "rollers", value: now }, disabled: { type: "datetime", disabled: true, value: now }, clear: { type: "time", showClearButton: true, value: new Date(2015, 11, 1, 6) }, eventDateBoxOptions: { applyValueMode: "useButtons", value: eventDateBoxValue, max: new Date(), min: new Date(1900, 0, 1), diffInDay: ko.computed(function() { return Math.floor(Math.abs((new Date() - eventDateBoxValue())/(24*60*60*1000))) + " days"; }) } }; ko.applyBindings(viewModel, document.getElementById("date-box-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="js/jquery-3.1.0.min.js"></script> <script src=""></script> <script src=""></script> <script src=""></script> <script src=""></script> <script src=""></script> <script type="text/javascript" src=""></script> <script type="text/javascript" src=""></script> <script type="text/javascript" src=""></script> <script type="text/javascript" src=""></script> <script type="text/javascript" src=""></script> <link rel="stylesheet" type="text/css" href="" /> <link rel="stylesheet" type="text/css" href="" /> <link rel="dx-theme" data-theme="generic.light" href="" /> <link rel="dx-theme" data-theme="android5.light" href="" /> <link rel="dx-theme" data-theme="ios7.default" href="" /> <link rel="dx-theme" data-theme="" href="" /> <link rel="dx-theme" data-theme="win10.white" 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="date-box-demo"> <div class="dx-fieldset"> <div class="dx-field"> <div class="dx-field-label">Date</div> <div class="dx-field-value"> <div data-bind="dxDateBox: dateFormat"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Time</div> <div class="dx-field-value"> <div data-bind="dxDateBox: timeFormat"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Date and time</div> <div class="dx-field-value"> <div data-bind="dxDateBox: dateTimeFormat"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Custom format</div> <div class="dx-field-value"> <div data-bind="dxDateBox: customFormat"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Date picker</div> <div class="dx-field-value"> <div data-bind="dxDateBox: dateByPicker"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Disabled</div> <div class="dx-field-value"> <div data-bind="dxDateBox: disabled"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Clear button</div> <div class="dx-field-value"> <div data-bind="dxDateBox: clear"></div> </div> </div> </div> <div class="dx-fieldset"> <div class="dx-fieldset-header">Event Handling</div> <div class="dx-field"> <div class="dx-field-label">Set Birthday</div> <div class="dx-field-value"> <div data-bind="dxDateBox: eventDateBoxOptions"></div> </div> </div> <div class="dx-field"> <div class="dx-field-value"> Your age is <div id="age" data-bind="text: eventDateBoxOptions.diffInDay"></div> </div> </div> </div> </div> </div> </body> </html>
.demo-container { height: 560px; } #age { display: inline-block; }