forked from ddrilling/asb_cloud_front
24 lines
581 B
TypeScript
24 lines
581 B
TypeScript
|
import { DatePicker } from 'antd'
|
||
|
import moment from 'moment'
|
||
|
import { formatDate } from './index'
|
||
|
|
||
|
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={formatDate}
|
||
|
showTime
|
||
|
onChange={(date) => onChange(date)}
|
||
|
{...other}
|
||
|
/>
|
||
|
)
|
||
|
|
||
|
export default DatePickerWrapper
|