DateRangePicker

v1.0.0-rc.8
@ui5/webcomponents
<ui5-daterange-picker>

Basic DateRangePicker

<ui5-daterange-picker id="mydaterange-picker1"></ui5-daterange-picker>

DateRangePicker with Minimum and Maximum Date - 1/1/2020 - 4/5/2020 format-pattern="dd/MM/yyyy"

<ui5-daterange-picker id="mydaterange-picker12" min-date="1/1/2020" max-date="4/5/2020" format-pattern="dd/MM/yyyy"></ui5-daterange-picker>

DateRangePicker with format-pattern='long'

<ui5-daterange-picker format-pattern='long'></ui5-daterange-picker>
	

Disabled DateRangePicker

<ui5-daterange-picker disabled></ui5-daterange-picker>
	

readonly DateRangePicker

<ui5-daterange-picker readonly></ui5-daterange-picker>
	

Overview

The DateRangePicker enables the users to enter a localized date range using touch, mouse, keyboard input, or by selecting a date range in the calendar.

Usage

The user can enter a date by: Using the calendar that opens in a popup or typing it in directly in the input field (not available for mobile devices). For the ui5-daterange-picker

ES6 Module Import

import @ui5/webcomponents/dist/DateRangePicker.js";

Keyboard Handling

The ui5-daterange-picker provides advanced keyboard handling.
When the ui5-daterange-picker input field is focused the user can increment or decrement the corresponding field of the JS date object referenced by _firstDateTimestamp propery if the caret symbol is before the delimiter character or _lastDateTimestamp property if the caret symbol is after the delimiter character. The following shortcuts are enabled:
  • [PAGEDOWN] - Decrements the corresponding day of the month by one
  • [SHIFT] + [PAGEDOWN] - Decrements the corresponding month by one
  • [SHIFT] + [CTRL] + [PAGEDOWN] - Decrements the corresponding year by one
  • [PAGEUP] - Increments the corresponding day of the month by one
  • [SHIFT] + [PAGEUP] - Increments the corresponding month by one
  • [SHIFT] + [CTRL] + [PAGEUP] - Increments the corresponding year by one

Properties/Attributes

You can use both properties and attributes with the same effect. The name of each attribute is listed below the name of the property, if different.

Name
Type
Default Value
Description
delimiter
string
"-"
Determines the symbol which separates the dates.
firstDateValue (readonly)
first-date-value
Date
Currently selected first date represented as JavaScript Date instance.
lastDateValue (readonly)
last-date-value
Date
Currently selected last date represented as JavaScript Date instance.
dateValue (readonly)
date-value
Date
Currently selected date represented as JavaScript Date instance.
disabled
boolean
false
Determines whether the ui5-date-picker is displayed as disabled.
formatPattern
format-pattern
string
""
Determines the format, displayed in the input field.
hideWeekNumbers
hide-week-numbers
boolean
false
Defines the visibility of the week numbers column.

Note: For calendars other than Gregorian, the week numbers are not displayed regardless of what is set.
since v1.0.0-rc.8
maxDate
max-date
string
""
Determines the maximum date available for selection.
since v1.0.0-rc.6
minDate
min-date
string
""
Determines the minimum date available for selection.
since v1.0.0-rc.6
name
string
""
Determines the name with which the ui5-date-picker will be submitted in an HTML form.

Important: For the name property to have effect, you must add the following import to your project: import "@ui5/webcomponents/dist/features/InputElementsFormSupport.js";

Note: When set, a native input HTML element will be created inside the ui5-date-picker so that it can be submitted as part of an HTML form. Do not use this property unless you need to submit a form.
placeholder
string
undefined
Defines a short hint, intended to aid the user with data entry when the ui5-date-picker has no value.

Note: When no placeholder is set, the format pattern is displayed as a placeholder. Passing an empty string as the value of this property will make the ui5-date-picker appear empty - without placeholder or format pattern.
primaryCalendarType
primary-calendar-type
CalendarType
"Gregorian"
Determines the calendar type. The input value is formated according to the calendar type and the picker shows the months and years from the specified calendar.

Available options are:
  • Gregorian
  • Islamic
  • Japanese
  • Buddhist
  • Persian
readonly
boolean
false
Determines whether the ui5-date-picker is displayed as read-only.
required
Boolean
false
Defines whether the ui5-date-picker is required.
since v1.0.0-rc.9
value
string
""
Defines a formatted date value.
valueState
value-state
ValueState
"None"
Defines the value state of the ui5-date-picker.

Available options are:
  • None
  • Error
  • Warning
  • Success
  • Information

Slots

This Element provides slot(s). This means it can display its child nodes.
Unless targeting the default slot, use the slot attribute to define the destination slot for each child.
Text, along with HTML Elements with no slot attribute, goes the the default slot.

Slot
Type
Description
valueStateMessage
HTMLElement
Defines the value state message that will be displayed as pop up under the ui5-date-picker.

Note: If not specified, a default text (in the respective language) will be displayed.
Note: The valueStateMessage would be displayed, when the ui5-date-picker is in Information, Warning or Error value state.

Events

This Web Component fires semantic events upon user interaction. You can bind to these events with the standard DOM APIs, such as addEventListener.

Name
Description
change
Fired when the input operation has finished by pressing Enter or on focusout.
input
Fired when the value of the ui5-date-picker is changed at each key stroke.
Theme: Quartz Light Quartz Dark Quartz High Contrast Black Quartz High Contrast White Belize High Contrast Black High Contrast White
Content Density: Cozy Compact
Text Direction: LTR RTL
Apply Cancel