A simple and reusable component to work with or select a date or a range of dates.
Note: Consumer of this component can customize the labels for header, timezone, cancel button, save button and even
error message via LocaleProvider
Examples
Usage with new API
Custom Range: 11 Jan,2025 09:24 AM – 17 Jan,2025 09:24 AM | UTC
Press down arrow key to navigate quick select options and tab key to navigate to calendar. Press the down arrow key to interact with the calendar and select a date. Press the escape button to close the calendar.Selected date range is from 11 Jan,2025 09:24 AM to 17 Jan,2025 09:24 AM.
Basic Usage
Press down arrow key to navigate quick select options and tab key to navigate to calendar. Press the down arrow key to interact with the calendar and select a date. Press the escape button to close the calendar.Selected date range is from 01/11/2025 to 01/17/2025.
States
Time Select
Disabled
Error
Press down arrow key to navigate quick select options and tab key to navigate to calendar. Press the down arrow key to interact with the calendar and select a date. Press the escape button to close the calendar.
Press down arrow key to navigate quick select options and tab key to navigate to calendar. Press the down arrow key to interact with the calendar and select a date. Press the escape button to close the calendar.
Press down arrow key to navigate quick select options and tab key to navigate to calendar. Press the down arrow key to interact with the calendar and select a date. Press the escape button to close the calendar.
Press down arrow key to navigate quick select options and tab key to navigate to calendar. Press the down arrow key to interact with the calendar and select a date. Press the escape button to close the calendar.
Press down arrow key to navigate quick select options and tab key to navigate to calendar. Press the down arrow key to interact with the calendar and select a date. Press the escape button to close the calendar.
Press down arrow key to navigate quick select options and tab key to navigate to calendar. Press the down arrow key to interact with the calendar and select a date. Press the escape button to close the calendar.
Format String
Select...
Press down arrow key to navigate quick select options and tab key to navigate to calendar. Press the down arrow key to interact with the calendar and select a date. Press the escape button to close the calendar.Selected date range is from 01/11/2025 to 01/17/2025.
Single Month
Press down arrow key to navigate quick select options and tab key to navigate to calendar. Press the down arrow key to interact with the calendar and select a date. Press the escape button to close the calendar.Selected date range is from 01/11/2025 to 01/17/2025.
Overrides
Press down arrow key to navigate quick select options and tab key to navigate to calendar. Press the down arrow key to interact with the calendar and select a date. Press the escape button to close the calendar.Selected date range is from 01/11/2025 to 01/17/2025.
Date and Time Select Overrides
Press down arrow key to navigate quick select options and tab key to navigate to calendar. Press the down arrow key to interact with the calendar and select a date. Press the escape button to close the calendar.Selected date range is from 01/11/2025 to 01/17/2025.
Time Range Picker with localization
Press down arrow key to navigate quick select options and tab key to navigate to calendar. Press the down arrow key to interact with the calendar and select a date. Press the escape button to close the calendar.Selected date range is from 01/11/2025 to 01/17/2025.
Date constraints
Press down arrow key to navigate quick select options and tab key to navigate to calendar. Press the down arrow key to interact with the calendar and select a date. Press the escape button to close the calendar.Selected date range is from 11/22/2021 to 12/03/2021.
NOTE: the valid range is [minDate, maxDate) since the Calendar sets seconds and milliseconds on end time to 59.999.
Consider a scenario where maxDate has the time 12:30:00.000 and user selects the same as End Time. It gets converted
to 12:30:59.999 which violates maxDate. Thus, the valid range is not inclusive of maxDate.
ApiTable
Time Range Picker Props
Name
Type
Default
Description
autoSizeInput
boolean
false
Adjusts the width according to value
clearable
boolean
false
Allows to clears value from input
disableTimezone
boolean
false
Hides the time zone picker
disabled
boolean
false
Renders component in disabled state.
displayVariant
'default' | 'compact' | 'iconButton'
If compact, it tries to minimize the size of input, by showing minimal info about the range upfront
excludeDates
array
A list of dates to disable. Array<Date>
filterDate
function
A filter function (Date => boolean) that is called to check the disabled state of a day. If false is returned the day is considered to be disabled.
fixedHeight
boolean
Defines if 6 rows should always be displayed for all the months.
formatString
string
MM/dd/yyyy
String format passed to date-fns.
intent
'default' | 'success' | 'warning' | 'error'
Defines the intent of the Input.
maxDate
date
A max date that is selectable.
minDate
date
A min date that is selectable.
monthsShown
number
A number of months rendered in the calendar.
onChange
function
Event handler that is called when any update is made to date either by selecting preset, directly selecting date from calendar or changing time.
onClose
function
A function () => {} that is called every time datepicker closes except when it closes due after submit.
onSubmit
function
Event handler that is called when user will press the save button
overrides
custom
Lets you customize all aspects of the component.
peekNextMonth
boolean
false
Defines if dates outside of the range of the current month are displayed.
placeholder
string
Input's placeholder.
showFullDateInSummary
boolean
false
If true, will show the full date with preset in input.