DatePicker
DateTimePicker puts a date and a time picker side by side with one Date value, as a replacement for <input type="datetime-local">. Picking a date keeps the time and the other way round; min and max limit the time on the boundary day too.
Pick a date and a time
Props
DatePicker
labelstringLabel text.
valueDate | nullSelected date.
onChange(date: Date) => voidCalled with the picked date.
minDateEarliest selectable date.
maxDateLatest selectable date.
placeholderstringDefault:'Select date'Text when no date is chosen.
errorstringError message shown below the control; sets the invalid style.
localestringLocale for formatting.
weekStartsOn0 | 1Default:0First day of the week.
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | – | Label text. |
value | Date | null | – | Selected date. |
onChange | (date: Date) => void | – | Called with the picked date. |
min | Date | – | Earliest selectable date. |
max | Date | – | Latest selectable date. |
placeholder | string | 'Select date' | Text when no date is chosen. |
error | string | – | Error message shown below the control; sets the invalid style. |
locale | string | – | Locale for formatting. |
weekStartsOn | 0 | 1 | 0 | First day of the week. |
DateTimePicker
labelReactNodeLabel for the date and time pair.
valueDate | nullDate and time.
onChange(date: Date) => voidCalled with a new Date holding the picked date and time.
minDateEarliest date and time (the time limit applies on that day only).
maxDateLatest date and time (the time limit applies on that day only).
stepnumberDefault:900Minute granularity of the time list, in seconds.
hour12booleanDefault:false12-hour clock with AM / PM.
errorstringError message shown below the control; sets the invalid style.
datePlaceholderstringDefault:'Select date'Text when no date is chosen.
timePlaceholderstringDefault:'Select time'Text when no time is chosen.
localestringLocale for formatting.
weekStartsOn0 | 1Default:0First day of the week.
| Prop | Type | Default | Description |
|---|---|---|---|
label | ReactNode | – | Label for the date and time pair. |
value | Date | null | – | Date and time. |
onChange | (date: Date) => void | – | Called with a new Date holding the picked date and time. |
min | Date | – | Earliest date and time (the time limit applies on that day only). |
max | Date | – | Latest date and time (the time limit applies on that day only). |
step | number | 900 | Minute granularity of the time list, in seconds. |
hour12 | boolean | false | 12-hour clock with AM / PM. |
error | string | – | Error message shown below the control; sets the invalid style. |
datePlaceholder | string | 'Select date' | Text when no date is chosen. |
timePlaceholder | string | 'Select time' | Text when no time is chosen. |
locale | string | – | Locale for formatting. |
weekStartsOn | 0 | 1 | 0 | First day of the week. |
Related hooks and theme:useDismissable