DatePickerWrapper переписан на TSX

This commit is contained in:
Александр Сироткин 2021-12-13 10:19:57 +05:00
parent 494fd8128c
commit 4afa7810ff
2 changed files with 23 additions and 13 deletions

View File

@ -1,13 +0,0 @@
import { DatePicker } from "antd"
import moment from "moment"
import {formatDate} from './index'
export const DatePickerWrapper = ({value, onChange, ...other}) => (<DatePicker
allowClear={false}
defaultValue={moment()}
value={moment.utc(value).local()}
format={formatDate}
showTime
onChange={(date) => onChange(date)}
{...other}
/>)

View File

@ -0,0 +1,23 @@
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