import { Moment } from 'moment' import { TimePicker, TimePickerProps } from 'antd' import { memo, useCallback, useMemo } from 'react' import { defaultTimeFormat, momentToTime, timeToMoment } from '@utils/datetime' import { TimeDto } from '@api' export type TimePickerWrapperProps = Omit, 'onChange'> & { value?: TimeDto, onChange?: (date: TimeDto | null) => any isUTC?: boolean } export const TimePickerWrapper = memo(({ value, onChange, isUTC, ...other }) => { const time = useMemo(() => value ? timeToMoment(value, isUTC) : null, [value, isUTC]) const onTimeChange = useCallback((time: Moment | null) => onChange?.(time ? momentToTime(time) : null), [onChange]) return ( ) }) export default TimePickerWrapper