DateTimePicker
Capture datetime from the user
Source
LLM docs
Docs
PackageIcon
DatePicker props
DateTimePicker supports most of the DatePicker props.
Read through the DatePicker documentation to learn about all component features that are not listed on this page.
Usage
With seconds
Presets
Use the presets prop to add custom date presets. Presets are displayed next to the calendar:
TimePicker props
You can pass props down to the underlying TimePicker component
with the timePickerProps prop. Example of enabling dropdown and setting 12h format
for the time picker:
Value format
Use the valueFormat prop to change the dayjs format of the value label:
Disabled state
Input props
DateTimePicker component supports Input and Input.Wrapper component features and all button element props. The DateTimePicker documentation does not include all features supported by the component – see the Input documentation to learn about all available features.
Input description
Clearable
Set the clearable prop to display a clear button in the right section. Note that if you set the rightSection
prop, the clear button will not be displayed.
Clear section mode
The clearSectionMode prop determines how the clear button and rightSection are rendered:
'both'(default) – render both the clear button andrightSection'rightSection'– render only the user-suppliedrightSection, ignore clear button'clear'– render only the clear button, ignorerightSection
Open picker in modal
By default, the picker is rendered inside Popover.
You can change that to Modal by setting dropdownType="modal":
Get element ref
Accessibility
If DateTimePicker is used without the label prop, it will not be announced properly by screen readers:
Set aria-label to make the input accessible. In this case the label will not be visible, but screen readers will announce it:
If the label prop is set, the input will be accessible and it is not required to set aria-label: