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