Antd's datepicker cannot set error messages with form.setFields

datepicker of antd cannot set error message with form.setFields

<FormItem label="" {...formItemLayout}>
  {form.getFieldDecorator("startTime", {
    rules: [
      {
        required: true,
        message: "",
      },
      {
        validator: (rule, value, cb) => {
          (value > moment()) ? cb() : cb(true)
        },
        message: "",
      },
    ],
  })(
    <DatePicker
      showTime
      disabledDate={start => start < moment()}
      onChange={changeStartTime}
      format={"YYYY-MM-DD HH:mm"} />,
  )}
</FormItem>
form.setFields({
   startTime: {
   errors: [new Error("")],
   },
 })

there is no response, and there is no response when setting value, while the Input component can set error messages normally

Mar.16,2021

I have this problem too. Have you found a solution?


you haven't set it to value., setFields: ({[fieldName]: {value: any, errors: [Error]}
}) = > void or setFieldsValue: ({[fieldName]: value}) = > void

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-1b2ad0c-2ba4f.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-1b2ad0c-2ba4f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?