Datetime Picker
A date and time picker built on shadcn/ui with no extra dependencies.
Installation
Usage
Hour cycle - 12H / 24H
Date picker or Time picker
Date Picker
Time Input
Year Dropdown Range
The year range will be: this year + yearRange and this year - yearRange.
Default is 50.
For example: This year is 2026, The year dropdown will be 1976 to 2076 which is generated by 2026 - 50 = 1976 and 2026 + 50 = 2076.
Locale
Import locale from date-fns
The following example is zhTW from date-fns.
Week start on Monday, Show week number, Disable outside days
Week start on Monday
Show week number
Disable outside days
Display Format
Visit date-fns to customize the format.
Placeholder
Granularity
Minute
Hour
Day
Disabled
Ref
Form
Properties
| Prop | Type | Default | Description |
|---|---|---|---|
value | Date | undefined | - | Date value. |
onChange | (Date) => void | - | When you pick a date, the |
hourCycle | 12 | 24 | 24 | Hour cycle that showing AM/PM or not. |
placeholder | string | Pick a date | The datetime picker placeholder. |
disabled | boolean | false | Disabled Datetime Picker. |
yearRange | number | 50 | The year dropdown range according to this year. By default is 50, which means this year ± 50. For example: This year is 2026. the year dropdown range will be 1976 to 2076. |
displayFormat | { hour24?: string, hour12?: string } | { hour24: 'PPP HH:mm:ss', hour12: 'PP hh:mm:ss b' } | Custom display format by |
granularity | 'day' | 'hour' | 'minute' | 'second' | second | The granularity prop allows you to control the smallest unit that is displayed by DatePicker. By default is |