React encountered the problem of inaccurate acquisition time when using DatePicker of Antd

for example, if I choose 2018-05-01 , the date and time obtained by
in the background is 2018-05-01 02:08:17 this, not 2018-05-01 00:00:00

look up what seems to be the time zone on the Internet? I don"t know what to do in this case

Mar.11,2021

can't directly tell you what's wrong, but you can try opening the debug tool to see how much data is submitted to the server.


I think this is a problem with format format.

it returns a moment default format seems to be YYYY-MM-DD hh:mm:ss

this is what the official documentation on the time zone says:


Form getFieldDecorator

{getFieldDecorator("time", {
  initialValue: data.time ? moment(data.time, format) : undefined,
  type: [{type: 'object'}]
})(<TimePicker minuteStep={30} format={format} placeholder=""/>)}

you need to deal with the value when you submit:

this.props.form.validateFieldAndScrol(err, values) {
  if (!err) {
    axios.post(url, {
      time: values.time && values.time.format('HH:mm'),
    }).then(res => {

        ...
    })

  }
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2bcd5-2b310.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2bcd5-2b310.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?