2021-12-13 10:19:57 +05:00
|
|
|
import { DatePicker } from 'antd'
|
|
|
|
import moment from 'moment'
|
2021-12-27 15:18:20 +05:00
|
|
|
import { defaultFormat } from '../../utils'
|
2021-12-13 10:19:57 +05:00
|
|
|
|
|
|
|
export type DatePickerWrapperProps = {
|
|
|
|
value: moment.Moment,
|
|
|
|
onChange: (date: moment.Moment | null) => any
|
|
|
|
[other: string]: any
|
|
|
|
}
|
|
|
|
|
|
|
|
export const DatePickerWrapper: React.FC<DatePickerWrapperProps> = ({value, onChange, ...other}) => (
|
|
|
|
<DatePicker
|
|
|
|
allowClear={false}
|
|
|
|
defaultValue={moment()}
|
|
|
|
value={moment.utc(value).local()}
|
2021-12-27 15:18:20 +05:00
|
|
|
format={defaultFormat}
|
2021-12-13 10:19:57 +05:00
|
|
|
showTime
|
|
|
|
onChange={(date) => onChange(date)}
|
|
|
|
{...other}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
|
|
|
|
export default DatePickerWrapper
|