Range Date Picker

Release candidate

DatePicker is composed of both a DateInput and Calendar controls, that allows users to select either a single date or a date range consisting of a start and end date, providing a flexible and intuitive way to choose dates.

Note: This tab list includes overflow; tab positions may be inaccurate or change when a tab is selected

Note

All date components requires LocalizationProvider to be set up in your application.

An uncontrolled DatePicker, composed of a DateInputRange and a Calendar component, allows users to select a date range when the selectionVariant prop is set to "range", without requiring explicit state management in the parent component, making it ideal for selecting start and end dates for various applications.

A controlled DatePicker, composed of a DateInputRange and a Calendar component, allows users to select a date range when the selectionVariant prop is set to "range", with the parent component explicitly managing the start and end date states, providing greater control over the date range selection process.

Use DatePickerRangeGridPanel to provide a grid of multiple calendars, enabling the user to select the date from a wider range of visible months.

The columns and numberOfVisibleMonths properties are responsive, allowing you to adjust the number of calendars or columns at each breakpoint for optimal display on different screen sizes.

A DatePicker with selectionVariant set to "range", inside a FormField, provides the field with a visible label, help text, and a status message for validation feedback.

When used with FormField, the validationStatus prop can be used to recreate an initial error state.

Disabled dates are not selectable. To implement this, use the isDayUnselectable prop to pass a function that determines whether a day is unselectable and provides the tooltip description.

Unselectable dates are visually distinct from selectable dates. When a user attempts to select an unselectable date, the calendar displays a tooltip with additional information. To implement this, use the isDayUnselectable prop to pass a function that determines whether a day is unselectable and provides the tooltip description.

Highlighted dates are marked by a triangle in the top right corner, indicating an event associated with that day. When a user hovers over a highlighted date, the calendar displays a tooltip with additional information. To implement this, use the isDayHighlighted prop to pass a function that determines whether a day is highlighted and provides the tooltip description.

To constrain the selected date within a specific range, use the minDate and/or maxDate props. If minDate is not provided, it defaults to the year 1900. If maxDate is undefined, it defaults to the year 2100. This ensures that the selected date remains within the specified range.

The composed nature of the DatePicker enables you to control the content of the overlay using the children prop. Use the recommended panels or compose them with your own.

You can change dates upon selection, or apply the selection with additional controls.

When the locale prop is provided, the DatePicker component uses it to define the locale, ensuring that date formats, month names, and other locale-specific elements are displayed according to the specified locale.

Use the timezone prop to display the selected date range in a specific timezone. This is particularly useful for applications that need to handle date and time data across different time zones, ensuring that users can accurately select and view date ranges based on their local time.

Note

If you need to work with a date string (e.g., in the YYYY-MM-DD format) and display it using a date picker, you don't need to configure a timezone. Simply use the dateAdapter.format and dateAdapter.parse functions with the same format parameter. Pass the formatted date to the selectedDate property and retrieve the date using the onSelectionChange callback.

A DatePicker component with a border provides a visually distinct area for selecting dates, enhancing the user interface by clearly delineating the component boundaries. This styling can improve usability and accessibility by making the calendar controls more noticeable and easier to interact with.