DevExtreme v23.1 is now available.

Explore our newest features/capabilities and share your thoughts with us.

Your search did not match any results.
Date Range Box


Use our DateRangeBox displayFormat property to change date display format as requirements dictate. This demo illustrates the following:

  • Locale-dependent format
    DateRangeBox formats date range values based upon the specified locale. You do not need to define a format with the displayFormat property. For more information, refer to the following help topic: Localize Dates, Numbers, and Currencies.

  • Built-in predefined formats
    DevExtreme allows you to apply various predefined formats. You can specify simple strings or shortcuts that define widely used date formats instead of complex expressions. This demo illustrates how to display dates using the "shortdate" format.

  • Locale Data Markup Language (LDML) pattern To define a custom date format string, use the LDML pattern. In this demo, the displayFormat property is set to "EEEE, d of MMM, yyyy". This expression displays week day, day number, month and year. The input field displays the formatted value. For additional information on supported format characters, refer to the following help topic: Custom Format String.

  • Add literal characters
    You can specify the displayFormat property as a string with literal and Locale Data Markup Language characters. You should wrap characters that are not part of the LDML pattern within quotation marks - otherwise, they may be interpreted as wildcards. In this demo, if you specify the word "Year" without quotation marks, the letter "a" is interpreted as an "AM/PM" placeholder.

To ensure that input values match displayFormat, you can apply an input mask to our DateRangeBox (set the control’s useMaskBehavior property to true).

For additional formatting-related information, please refer to the following help topic: Value Formatting.

Backend API
Copy to CodePen
$(() => { const msInDay = 1000 * 60 * 60 * 24; const now = new Date(); const startDate = new Date(now.getTime() - msInDay * 3); const endDate = new Date(now.getTime() + msInDay * 3); $('#default').dxDateRangeBox(getDateRangeBoxProps({ startDatePlaceholder: '12/31/2018', endDatePlaceholder: '12/31/2018', })); $('#constant').dxDateRangeBox(getDateRangeBoxProps({ displayFormat: 'shortdate', startDate, endDate, })); $('#pattern').dxDateRangeBox(getDateRangeBoxProps({ displayFormat: 'EEEE, d of MMM, yyyy', startDate, endDate, })); $('#escape').dxDateRangeBox(getDateRangeBoxProps({ displayFormat: "'Year': yyyy, 'Month': MMM, 'Day': d", startDate, endDate, })); function getDateRangeBoxProps(props) { return { showClearButton: true, useMaskBehavior: true, openOnFieldClick: false, ...props, }; } });
<!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=""></script> <script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script> <link rel="stylesheet" type="text/css" href="" /> <link rel="stylesheet" type="text/css" href="styles.css" /> <script src=""></script> <script src="index.js"></script> </head> <body class="dx-viewport"> <div class="demo-container"> <div class="dx-fieldset"> <div class="dx-field"> <div class="dx-field-label">Locale-dependent format</div> <div class="dx-field-value"> <div id="default"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Built-in predefined format</div> <div class="dx-field-value"> <div id="constant"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Locale Data Markup Language (LDML) pattern</div> <div class="dx-field-value"> <div id="pattern"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Format with literal characters</div> <div class="dx-field-value"> <div id="escape"></div> </div> </div> </div> </div> </body> </html>
.demo-container { height: 610px; } .dx-fieldset { min-height: 500px; } .dx-field { padding: 8px; }