DatePicker
To select or input a date.
#
When To UseBy clicking the input box, you can select a date from a popup calendar.
#
Examples#
Date picker#
Basic usage#
Controlled usage#
allowClear#
Choose Time#
Choose Time & with minute step#
Disabled Specified Date#
Ranger picker#
Basic usage~
~
#
With time picker~
#
allowClear~
~
#
Calendar usageSu | Mo | Tu | We | Th | Fr | Sa |
---|---|---|---|---|---|---|
26 | 27 | 28 | 29 | 30 | 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 | 1 | 2 | 3 | 4 | 5 | 6 |
#
API#
Common APIProperty | Description | Type | Default |
---|---|---|---|
allowClear | Whether to show clear button | boolean | false |
showTime | to provide an additional time selection | boolean \| ShowTime Options | false |
disabledDate | specify the date that cannot be selected | (current: Date) => boolean | |
disabledTime | to specify the time that cannot be selected | (current: Date, type: 'start' \| 'end') => boolean | |
placeholder | placeholder of date input | string |
#
ShowTime OptionsProperty | Description | Type | Default |
---|---|---|---|
showHour | whether show hour | Boolean | true |
showMinute | whether show minute | Boolean | true |
showSecond | whether show second | Boolean | true |
use12Hours | 12 hours display mode | Boolean | false |
hourStep | interval between hours in picker | Number | 1 |
minuteStep | interval between minutes in picker | Number | 1 |
secondStep | interval between seconds in picker | Number | 1 |
hideDisabledOptions | whether hide disabled options | Boolean | false |
#
DatePickerProperty | Description | Type | Default |
---|---|---|---|
value | to set date | Date | |
defaultValue | to set default date, if start time or end time is null or undefined, the date range will be an open interval | Date | |
onChange | a callback function, can be executed when the selected time is changing | (date: Date \| null, dateStrings: [string, string]) => void |
#
RangeDatePickerProperty | Description | Type | Default |
---|---|---|---|
value | to set date | [Date, Date] | |
defaultValue | to set default date, if start time or end time is null or undefined, the date range will be an open interval | [Date, Date] | |
onChange | a callback function, can be executed when the selected time is changing | (date: [Date, Date] \| null) => void | |
ranges | preseted ranges for quick selection | { String \| [range: string]: [Date, Date] } \| { [range: string]: () => [Date, Date] } |