I have a react form where I'm using react-datepicker, when I try to populate the value of the date field coming from the database I get the error invalid time value.
I have tried several time formats but to no avail. My solution below.
<DatePicker
className="createMeditation-input"
onChange={d => this.handleDateChange(d)}
selected={data.publishedDate}
autoComplete="off"
placeholderText="Please select a publish date"
id="DatePicker"
dateFormat="MMMM dd, yyyy"
disabled={uncontrolledFormState ? true : false}
/>
The value of published date in the selected prop is 2020-12-31T23:00:00.000Z
The issue appears to be with the date format but I don't know what selected will accept. Please let met know if my question is clear enough.