problem description
what to do if ant-design datePicker sets the default value to empty
the environmental background of the problems and what methods you have tried
the following conditions will occur at present
related codes
/ / Please paste the code text below (do not replace the code with pictures)
<DatePicker showTime defaultValue={moment(listInfo.startTime, dateFormat)} format={dateFormat}
onChange={(val) => {
onUpdateCompensateListInfo("startTime", moment(val, dateFormat))
}} />
then I set the initial time in redux
startTime: moment(new Date(), "YYYY-MM-DD HH:mm:ss"),
endTime: null
when I give a default initial time, it displays normally. When I give the initial value to null, I will error, invalid date, and then the date is all NAN
.what result do you expect? What is the error message actually seen?
I hope to get a way to initialize my date. Thank you