* Вывод в консоль скрыт в TimezoneSelect

* Добавлена обработка falsy значений в DatePickerWrapper
This commit is contained in:
goodmice 2022-04-18 10:51:50 +05:00
parent 905036cc71
commit 6d833c75c5
2 changed files with 6 additions and 9 deletions

View File

@ -37,14 +37,11 @@ export const TimezoneSelect = memo<TimezoneSelectProps>(({ onChange, value, defa
useEffect(() => setDefaultTimezone(defaultValue ? findTimezoneId(defaultValue) : null), [defaultValue])
useEffect(() => setId(value ? findTimezoneId(value) : null), [value])
const onValueChanged = useCallback((id: TimezoneId | null) => {
console.log(id)
onChange?.({
timezoneId: id,
hours: id ? rawTimezones[id] : 0,
isOverride: false,
})
}, [onChange])
const onValueChanged = useCallback((id: TimezoneId | null) => onChange?.({
timezoneId: id,
hours: id ? rawTimezones[id] : 0,
isOverride: false,
}), [onChange])
return (<Select {...other} onChange={onValueChanged} value={id} defaultValue={defaultTimezone} />)
})

View File

@ -18,7 +18,7 @@ export const DatePickerWrapper = memo<DatePickerWrapperProps>(({ value, onChange
format={defaultFormat}
defaultValue={moment()}
onChange={(date) => onChange?.(date)}
value={isUTC ? moment.utc(value).local() : moment(value)}
value={value && (isUTC ? moment.utc(value).local() : moment(value))}
{...other}
/>
))