-
Data Grid
- Overview
-
Data Binding
-
Paging and Scrolling
-
Editing
-
Grouping
-
Filtering and Sorting
- Focused Row
-
Row Drag & Drop
-
Selection
-
Columns
- State Persistence
-
Appearance
-
Templates
-
Data Summaries
-
Master-Detail
-
Export to PDF
-
Export to Excel
-
Adaptability
- Keyboard Navigation
-
Pivot Grid
- Overview
-
Data Binding
-
Field Chooser
-
Features
-
Export to Excel
-
Tree List
- Overview
-
Data Binding
- Sorting
- Paging
-
Editing
- Node Drag & Drop
- Focused Row
-
Selection
-
Filtering
-
Column Customization
- State Persistence
- Adaptability
- Keyboard Navigation
-
Scheduler
- Overview
-
Data Binding
-
Views
-
Features
- Virtual Scrolling
-
Grouping
-
Customization
- Adaptability
-
Html Editor
-
Chat
-
Diagram
- Overview
-
Data Binding
-
Featured Shapes
-
Custom Shapes
-
Document Capabilities
-
User Interaction
- UI Customization
- Adaptability
-
Charts
- Overview
-
Data Binding
-
Area Charts
-
Bar Charts
- Bullet Charts
-
Doughnut Charts
-
Financial Charts
-
Line Charts
-
Pie Charts
-
Point Charts
-
Polar and Radar Charts
-
Range Charts
-
Sparkline Charts
-
Tree Map
-
Funnel and Pyramid Charts
- Sankey Chart
-
Combinations
-
More Features
-
Export
-
Selection
-
Tooltips
-
Zooming
-
-
Gantt
- Overview
-
Data
-
UI Customization
- Strip Lines
- Export to PDF
- Sorting
-
Filtering
-
Gauges
- Overview
-
Data Binding
-
Bar Gauge
-
Circular Gauge
-
Linear Gauge
-
Navigation
- Overview
- Accordion
-
Menu
- Multi View
-
Drawer
-
Tab Panel
-
Tabs
-
Toolbar
- Pagination
-
Tree View
- Right-to-Left Support
-
Layout
-
Editors
- Overview
- Autocomplete
-
Calendar
- Check Box
- Color Box
-
Date Box
-
Date Range Box
-
Drop Down Box
-
Number Box
-
Select Box
- Switch
-
Tag Box
- Text Area
- Text Box
- Validation
- Custom Text Editor Buttons
- Right-to-Left Support
- Editor Appearance Variants
-
Forms and Multi-Purpose
- Overview
- Button Group
- Field Set
-
Filter Builder
-
Form
- Radio Group
-
Range Selector
- Numeric Scale (Lightweight)
- Numeric Scale
- Date-Time Scale (Lightweight)
- Date-Time Scale
- Logarithmic Scale
- Discrete scale
- Custom Formatting
- Use Range Selection for Calculation
- Use Range Selection for Filtering
- Image on Background
- Chart on Background
- Customized Chart on Background
- Chart on Background with Series Template
- Range Slider
- Slider
-
Sortable
-
File Management
-
File Manager
- Overview
-
File System Types
-
Customization
-
File Uploader
-
-
Actions and Lists
- Overview
-
Action Sheet
-
Button
- Floating Action Button
- Drop Down Button
-
Context Menu
-
List
-
Lookup
-
Maps
- Overview
-
Map
-
Vector Map
-
Dialogs and Notifications
-
Localization
JavaScript/jQuery Date Box - Overview
The JavaScript DateBox editor helps users enter or modify date and time values.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
$(() => {
const now = new Date();
$('#date').dxDateBox({
type: 'date',
value: now,
inputAttr: { 'aria-label': 'Date' },
});
$('#time').dxDateBox({
type: 'time',
value: now,
inputAttr: { 'aria-label': 'Time' },
});
$('#date-time').dxDateBox({
type: 'datetime',
value: now,
inputAttr: { 'aria-label': 'Date Time' },
});
$('#custom').dxDateBox({
displayFormat: 'EEEE, MMM dd',
value: now,
inputAttr: { 'aria-label': 'Custom Date' },
});
$('#date-by-picker').dxDateBox({
pickerType: 'rollers',
value: now,
inputAttr: { 'aria-label': 'Picker Date' },
});
$('#disabled').dxDateBox({
type: 'datetime',
disabled: true,
value: now,
inputAttr: { 'aria-label': 'Disabled' },
});
$('#disabledDates').dxDateBox({
type: 'date',
pickerType: 'calendar',
value: new Date(2017, 0, 3),
disabledDates: federalHolidays,
inputAttr: { 'aria-label': 'Disabled' },
});
$('#clear').dxDateBox({
type: 'time',
showClearButton: true,
value: new Date(2015, 11, 1, 6),
inputAttr: { 'aria-label': 'Clear Date' },
});
const startDate = new Date(1981, 3, 27);
$('#birthday').dxDateBox({
applyValueMode: 'useButtons',
value: startDate,
max: new Date(),
min: new Date(1900, 0, 1),
inputAttr: { 'aria-label': 'Birth Date' },
onValueChanged(data) {
dateDiff(new Date(data.value));
},
});
function dateDiff(date) {
const diffInDay = Math.floor(Math.abs((new Date() - date) / (24 * 60 * 60 * 1000)));
return $('#age').text(`${diffInDay} days`);
}
dateDiff(startDate);
});
xxxxxxxxxx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>↔</head>
<body class="dx-viewport">
<div class="demo-container">
<div class="dx-fieldset">
<div class="dx-field">
<div class="dx-field-label">Date</div>
<div class="dx-field-value">
<div id="date"></div>
</div>
</div>
<div class="dx-field">
<div class="dx-field-label">Time</div>
<div class="dx-field-value">
<div id="time"></div>
</div>
</div>
<div class="dx-field">
<div class="dx-field-label">Date and time</div>
<div class="dx-field-value">
<div id="date-time"></div>
</div>
</div>
<div class="dx-field">
<div class="dx-field-label">Custom format</div>
<div class="dx-field-value">
<div id="custom"></div>
</div>
</div>
<div class="dx-field">
<div class="dx-field-label">Date picker</div>
<div class="dx-field-value">
<div id="date-by-picker"></div>
</div>
</div>
<div class="dx-field">
<div class="dx-field-label">Clear button</div>
<div class="dx-field-value">
<div id="clear"></div>
</div>
</div>
<div class="dx-field">
<div class="dx-field-label">Disabled</div>
<div class="dx-field-value">
<div id="disabled"></div>
</div>
</div>
<div class="dx-field">
<div class="dx-field-label">Disable certain dates</div>
<div class="dx-field-value">
<div id="disabledDates"></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 id="birthday"></div>
</div>
</div>
<div class="dx-field">
<div class="dx-field-value"> Your age is <div id="age"></div> </div>
</div>
</div>
</div>
</body>
</html>
xxxxxxxxxx
#age {
display: inline-block;
}
xxxxxxxxxx
const federalHolidays = [
new Date(2017, 0, 1),
new Date(2017, 0, 2),
new Date(2017, 0, 16),
new Date(2017, 1, 20),
new Date(2017, 4, 29),
new Date(2017, 6, 4),
new Date(2017, 8, 4),
new Date(2017, 9, 9),
new Date(2017, 10, 11),
new Date(2017, 10, 23),
new Date(2017, 11, 25),
];
This demo illustrates the following JavaScript DateBox properties:
-
value
A value the JavaScript DateBox displays. -
type
Specifies whether the JavaScript DateBox allows users to select one of the following types:-
"date"
Users can select the date from the calendar, or they can type in their own date value (in the required format). -
"time"
Users can select a time from a range between 12:00 AM and 11:30 PM at 30-minute intervals, or they can type in their own time value (in the required format). Specify the interval property to set the time interval. -
"datetime"
Users can select the date from the calendar and the time from the spin and dropdown editors. They can also choose the Today button.
-
-
displayFormat
A date/time display format. You can use one of the predefined formats or specify a custom format. This demo illustrates the latter. -
pickerType
Specifies the type of UI used to select a date or time. This demo shows how to change a calendar to a roller date picker. -
showClearButton
Specifies whether to display the button that clears the JavaScript DateBox value. -
disabled
Specifies whether the JavaScript DateBox responds to user interaction. -
disabledDates
Dates that are not available for selection. -
applyValueMode
Defines whether the selected value applies instantly or after a user clicks the Apply button.
To get started with the DevExtreme JavaScript DateBox component, refer to the following tutorial for step-by-step instructions: Getting Started with JavaScript DateBox.