TimeFormatterThis is a React component
SourceFormats a time input based on the browser's locale using Date.toLocaleString.
If the value
is a string the time is parsed from it and a dummy Date
object will be created. Note that you can
pass localeOptions.timeZone
but it will give the wrong results if value
doesn't include the timezone offset.
Valid strings are:
3:55
- hour & minutes09:30:15
- hour, minutes, seconds (with leading zero)22:40:15.320
- includes milliseconds10:30:15.345+10:00
- includes timezone offset
Alternatively value
can be passed directly as a Date
in which case toLocaleString
will be called on it directly.
If no value is provided blankLabel
is returned.
If an invalid value is provided invalidValueLabel
is returned.
This is the default formatter used for TimeField
See also parseTime and [formatTime])(doc:formatTime)
Parameter | Type | Description | |
---|---|---|---|
props.blankLabel | ReactNode | What to render when Defaults to | |
props.invalidValueLabel | ReactNode | What to render when passed value is not a valid time Defaults to | |
props.localeOptions | Options to pass through to toLocaleString | ||
props.locales | string|Array | Optional locales to use. See using locales for more information. | |
* | props.value | string|Date|null | The value to parse. Should be in one of the following formats
|