import React from 'react'; import { Button, DatePicker, Form, TimePicker } from 'antd'; const { RangePicker } = DatePicker; const formItemLayout = { labelCol: { xs: { span: 24 }, sm: { span: 8 }, }, wrapperCol: { xs: { span: 24 }, sm: { span: 16 }, }, }; const config = { rules: [{ type: 'object' as const, required: true, message: 'Please select time!' }], }; const rangeConfig = { rules: [{ type: 'array' as const, required: true, message: 'Please select time!' }], }; const App: React.FC = () => { const onFinish = (fieldsValue: any) => { // Should format date value before submit. const rangeValue = fieldsValue['range-picker']; const rangeTimeValue = fieldsValue['range-time-picker']; const values = { ...fieldsValue, 'date-picker': fieldsValue['date-picker'].format('YYYY-MM-DD'), 'date-time-picker': fieldsValue['date-time-picker'].format('YYYY-MM-DD HH:mm:ss'), 'month-picker': fieldsValue['month-picker'].format('YYYY-MM'), 'range-picker': [rangeValue[0].format('YYYY-MM-DD'), rangeValue[1].format('YYYY-MM-DD')], 'range-time-picker': [ rangeTimeValue[0].format('YYYY-MM-DD HH:mm:ss'), rangeTimeValue[1].format('YYYY-MM-DD HH:mm:ss'), ], 'time-picker': fieldsValue['time-picker'].format('HH:mm:ss'), }; console.log('Received values of form: ', values); }; return (