value
Description
sets the value of a time pickerType
Date object
Default
new Date(0, 0, 0, 0, 0);
Example
<!-- shows the current time -->
<TimePicker value={new Date()} />
<!-- shows the specified hour and minutes -->
<TimePicker value={new Date(2023, 3, 16, 12, 12)} />
<!-- shows the midnight time of the specified date -->
<TimePicker value={new Date(2023, 3, 16)} />
Details
The Date() constructor is used to get the value of the property - a Date object.
The options for setting time are the following:
- you can set the time via the last two parameters of the new Date(YYYY, MM, DD, HH, mm) function. The time is displayed according to the passed hour and minutes values
- you can call the new Date() function with no parameters, to show the current date and time
note
Note that if you provide a date with no time specified, e.g. new Date(2023, 3, 16)
, the midnight time will be shown.
Related article: Setting the value
Related sample: TimePicker