I'm currently storing a date in my database in the following format:
2021-05-07T00:00:00.000Z
I'm wanting to take this value in my React app and place it as the value within my date input when the component first loads.
However, it just keeps defaulting to today's date.
I can't figure out what I'm doing wrong - can anyone point out how I should refactor my code so that the date mentioned above is passed in to the initial value of my date input?
For reference - the parent component manages the date state, and this is passed down as props. The state value is like mentioned above.
Second reference - the value is definitely getting passed down, as console logs of 'dueDate' show the above value.
const CalendarDates = ({ dueDate, setDueDate }) => {
const handleChange = (event) => {
setDueDate(event.target.value)
}
return (
<div className="calendar-dates-container">
<div className="calendar-due-date">
<i className="fas fa-calendar-week"></i>
<input value={dueDate} type="date" onChange={handleChange} />
</div>
</div>
)
}