✨(react) add a timezone props on date picker components
By default, component's timezone is the user locale timezone. Component now offers a way to set its timezone to any supported Intl timezone format. Please note that output values from the component will always be converted to a UTC timezone.
This commit is contained in:
committed by
aleb_the_flash
parent
0dc46d1144
commit
cd42afb10e
@@ -38,10 +38,10 @@ export const DatePicker = (props: DatePickerProps) => {
|
||||
// Force clear the component's value when passing null or an empty string.
|
||||
props.value === "" || props.value === null
|
||||
? null
|
||||
: parseDateValue(props.value),
|
||||
defaultValue: parseDateValue(props.defaultValue),
|
||||
: parseDateValue(props.value, props.timezone),
|
||||
defaultValue: parseDateValue(props.defaultValue, props.timezone),
|
||||
onChange: (value: DateValue | null) => {
|
||||
props.onChange?.(convertDateValueToString(value));
|
||||
props.onChange?.(convertDateValueToString(value, props.timezone));
|
||||
},
|
||||
};
|
||||
const pickerState = useDatePickerState(options);
|
||||
|
||||
Reference in New Issue
Block a user