Intro
The date range selection is a UI component used to enter a date range by typing two dates in the input field or selecting a date range in the calendar. In specific scenarios, it also supports a single date entry.
Date range selection
Component availability
This component is available in the following libraries:
When to Use
Use the date range selection to:
- Let users select a date range.
Don’t use the date range selection to:
- Provide a combined date and time input component. Use the date/time picker instead.
- Enable tasks where selecting a range is not the primary goal. Use the date picker instead.
- Let users select from a mix of absolute and relative dates or ranges. Use the dynamic date range instead.
- Offer selection of multiple non-consecutive days. Use the calendar instead.
- Choose the appropriate date range selection type (date, month, or year) based on the required level of granularity.
- Support direct date entry by typing the start and end dates into the input field.
- Use value states and value state messages to communicate validation and status.
- Use mixed calendar views only when users need to compare or work across different calendar systems.
- Prefill the date range input field when it supports the workflow, providing default values that help users complete tasks faster.
- Adapt the delimiter and date formats to regional and localization requirements.
- Use minimum and maximum dates to restrict selectable ranges and prevent invalid or irrelevant selections.
- Set a custom initial focus date to guide users directly to the most relevant period.
- Mark special dates such as holidays, events, or unavailable days and explain their meaning using a legend.
- Use an icon button, text button, or link to trigger the popover when the input field should remain hidden from view.
- Provide tooltips on the date range selection button and the calendar to improve clarity and usability.
Anatomy
A date range selection consists of the following elements:
- Date range input field: Input field for entering a start and end date.
- Date range selection button: The button that opens the date range selection popover.
- Date range selection container: Popover containing the calendar.
- Selected date range: Highlights the chosen start and end dates in the calendar.
For more details about the calendar container, see the calendar.
Date range selection anatomy
Types
The date range selection supports several configuration modes that determine the level of granularity. Each mode defines whether the component operates on dates, months, or years.
Date range
Basic date range selection
Month range
This type supports selecting a range of whole months. The calendar opens in month view, where only months are selectable. Month values can also be entered directly in the input field to define the range.
Note: Day selection is not available in the month range mode.
Date range selection in month range mode
Year range
This type allows users to pick specific years. The calendar opens in year view, where only years can be selected. Users can also type in the input field to enter the desired year.
Note: Day and month selections are not available in the year range mode.
Date range selection in year range mode
Mixed calendar
Date range selection with mixed calendar
States
The date range selection component supports various states for interaction and validation. Each state indicates the component’s current status.
Component states
A. Enabled: Displays the active, editable state.
B. Disabled: Displays a visible, non-interactive state.
C. Read-only: Displays a fixed, non-editable state. Content can be selected and copied.
Date range selection component states
For more information, see Component States.
Interaction states
The date range selection has five interaction states:
A. Regular: Displays the default interaction state of the input field and the date range selection button.
B. Hover on input: Displays the hover state when the cursor is over the input field.
C. Hover on button: Displays the hover state when the cursor is over the date range selection button.
D. Active: Displays the focused state of the input field ready for user input.
E. Active button state: The date range selection button is active, displaying the calendar.
Date range selection interaction states
For more information, see Interaction States.
Value states
The date range selection input supports four value states to indicate different validation or informational statuses:
A. Negative: Indicates an invalid date value.
B. Critical: Indicates a date value that requires attention.
C. Positive: Confirms a valid date value.
D. Information: Indicates neutral status or contextual information, such as a recommendation.
Date range selection value states
For more information, see How to Use Semantic Colors.
Value states with value state messages
When users make a selection, the component displays a value state message in the input field indicating whether the entered date is invalid, requires attention, or contains additional information. This message also appears in the popover when it is open.
Note: The positive state does not display a value state message.
Date range selection with value state messages
For more information, see Value States.
Focus state
The focus state indicates which element is currently focused.
A. Unfocused: Displays the default, non-focused state.
B. Focused: Displays a visible focus border around the input field and active calendar elements.
Date range selection focus state
For more information, see Focus States.
Selection state
The selection state indicates which date or date range is currently selected.
A. Unselected: Displays dates in their default state.
B. Selected: Highlights the selected date or date range.
Note: The dates between the start and end of the range display a distinct visual indication.
Selection states of the date range selection component
For more information, see Selection States.
Behavior and Interaction
Selecting a date range
The users can type two dates into the date range input field or click the calendar icon to open the calendar and select a date. This behavior works across desktops, tablets, and smartphones.
Input field entry
Typing a valid start and end date updates the selected range in the calendar.
A. Regular: Displays the default state with placeholder text.
B. Input active: Displays the focused, editable state with a visible caret.
C. Date entered: Displays the entered date range in the input field.
Date range selection input entry
Range selection
Clicking the calendar icon (A) opens the calendar to select a date range. After choosing the start date (B), hovering over subsequent dates highlights them to indicate the range (C). Selecting the end date closes the calendar and displays the selected range in the input field (D).
The same behavior applies to selecting date, month, and year ranges.
Date range selection
Single-date selection
The date range selection supports single-date input. Users can enter the same date in the input field or select the same day as both start and end date in the calendar. The same behavior applies when selecting a single month or year.
Single-date selection
No selection
The user may close the calendar without selecting a date range. Clicking outside of the component closes the calendar and no date selection is made.
Open date range selection popover from another component :badge, info, large, _, SAPUI5 Only:
The date range selection can be triggered by another component such as a text button, icon button, or link. In this case, the date range selection popover opens without an input field.
Opening date range selection popover by another component
Tooltip
The date range selection supports tooltips for the date range selection button and the calendar. For more information, see Calendar.
Tooltip on the date range selection button
Responsiveness
Date range selection sizes
The date range selection is available in two different sizes: compact and cozy.
- Compact reduces the dimensions to display more information within the interface, making it suitable for devices operated with a mouse and keyboard.
- Cozy provides larger dimensions optimized for fingertip interaction.
For more information, see Content Density (Cozy and Compact).
Size S (Smartphones)
On mobile devices, interaction works similarly to mouse input, but without the hover effect. Users can tap the input field to enter a date range manually or tap the calendar icon to open the calendar. For more information, see Gestures.
When the calendar opens on mobile phones, it appears in cozy mode within a full-screen dialog optimized for small screens. The dialog title uses the input field label or defaults to “Select” if no label is provided. Selecting a start and end date defines the range. Users can confirm or cancel the selection using the OK and Cancel buttons in the footer.
Date range selection on smartphone in cozy mode
Size M and L
On size M (tablets) and L (desktops), the date range selection opens as a popover containing a calendar. Selecting a start and end date updates the input field and closes the popover. Clicking anywhere outside the popover cancels the interaction and dismisses it without changing the values.
Date range selection in compact and cozy mode
Accessibility
SAP follows international standards, such as WCAG and WAI-ARIA, and strives to make our business solutions accessible and inclusive.
For more information, see Accessibility in SAP Fiori and the Accessibility Design Tools Handbook.
Keyboard navigation
The following keyboard combinations are supported by the SAPUI5 date range selection component.
Screen reader support
For details on screen reader support and Accessible Rich Internet Applications (ARIA), see the UI5 Screen Reader Support and WAI-ARIA Authoring.
Content
Placeholder
Date range selection with default placeholder
Delimiter
Date range selection with customized delimiter
Display format
It is possible to customize the formatting of dates in the input. Supported formats include short, medium, and long, as well as specific custom formats. These formats adjust to different local settings that have been configured in the browser.
Date range selection with different format pattern
Value format
Customizing the value format defines how the start and end dates are parsed and stored internally, and determines which calendar view (days, months, or years) is displayed.
A: When set to YYYY-MM-DD, the component displays days for selecting a date range.
B: When set to YYYY-MM, the component displays months for selecting a month range.
C: When set to YYYY, the component displays years for selecting a year range.
Date range selection value format examples
Special dates with legend :badge, info, large, _, SAPUI5 Only:
The calendar supports marking special dates to indicate their meaning (for example, holidays, booked or unavailable days, events or reminders). Special dates are indicated by distinct colors explained in a legend. The legend includes 20 color placeholders plus standard colors for today, selected, working and non-working day.
Date range selection with special dates and legend
Localization
The date range selection supports left-to-right (LTR) and right-to-left (RTL) reading directions.
Left-to-right date range selection
Right-to-left date range selection
Features
Restricted date range
Date range selection with minimum and a maximum date
Custom initial focus date :badge, info, large, _, SAPUI5 Only:
Date range selection with custom initial focus date
Current date :badge, info, large, _, SAPUI5 Only:
Date range selection with “Today” button
Footer :badge, info, large, _, SAPUI5 Only:
Add a footer with OK and Cancel buttons only when users need to review or adjust the range before confirming and the popover should remain open after selection.
By default, the popover closes after selecting a date range, month, or year.
Date range selection with footer
Supported calendars
The date range selection supports five calendar types – Gregorian (default), Islamic, Japanese (A), Persian (B), and Buddhist (C).
Examples of date range selection with different calendar types
Calculating calendar weeks
The calendar supports defining the first day of the week, and the first week of the year. This enables different calendar conventions, such as Default (A) (which is based on the active format locale), ISO 8601, Middle Eastern (B), or Western Traditional (C).
For more information, see Calendar.
Examples of date range selection with different calendar options
Framework Comparison
Some behaviors differ between frameworks due to implementation specifics. The table below summarizes the differences between SAPUI5 and SAP Web Components and lists the framework-specific patterns.
[internal_only] To request one of these features for SAP Web Components, submit an InnerSource request.[/internal_only]
Related Links
Implementation
SAPUI5
Date Range Selection (samples)
Date Range Selection
(API reference)
SAP Web Components
Implementation
SAPUI5
Date Range Selection (samples)
Date Range Selection
(API reference)
SAP Web Components
UI Kit (Figma)
SAP Fiori for Web UI Kit / Date Picker