I am using ANTD (https://ant.design/) for the project, ANTD is working fine with other components whereas I am facing issue while using DatePicker(https://ant.design/components/date-picker/). DatePicker uses moment(https://momentjs.com/)
In a form initially, I want all the fields with a placeholder and once the user fills the form it will be displayed to him/her. Once added user can edit their data.
Setting data works fine but I am unable to set date field initially as empty so that I am able to show the user a field with a placeholder
I am setting the date field as
initialValue: moment(null) => invalid date
initialValue: moment('') => invalid date
initialValue: moment(undefined) => current date // i don't want current date i want empty (to show the placeholder instead)
where as when i am getting user selected while setting the date it works perfectly fine.
initialValue: moment(userSelectedDate) => user selected date
initialValue
prop? – Thanh Le Hai HoanginitialValue
prop – Thanh Le Hai HoangselectedDate
and setinitialValue = this.state.selectedDate
. Try to set the init value ofselectedDate
isundefined
– Thanh Le Hai Hoang