asb_cloud_front/src/components/Table/DatePickerWrapper.tsx

24 lines
591 B
TypeScript

import { DatePicker } from 'antd'
import moment from 'moment'
import { defaultFormat } from '../../utils'
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()}
format={defaultFormat}
showTime
onChange={(date) => onChange(date)}
{...other}
/>
)
export default DatePickerWrapper