0

In my react app, I have an that looks like:

<input
  type="date"
  className="form-control form-control-lg"
  onFocus={(e) => (e.currentTarget.type = "text")}
  onBlur={(e) => (e.currentTarget.type = "date")}
  name="start_date"
  placeholder="mm/dd/yyyy"
  defaultValue={projectDetails.start_date}
  onChange={onChange}
/>

I am passing in the value "05-06-2004". I can see the value in the dev tools inspector, but I am not seeing it in the actual input. Any idea why? enter image description here

Jon
  • 622
  • 8
  • 29
  • 1
    Are you sure the correct format to set the value is `MM-DD-YYYY`? What if you try `YYYY-MM-DD` or `MM/DD/YYYY`? – WOUNDEDStevenJones Feb 14 '22 at 17:14
  • 2
    Your date format is faulty. See [How to set input type date's default value to today?](https://stackoverflow.com/questions/6982692/how-to-set-input-type-dates-default-value-to-today) – isherwood Feb 14 '22 at 17:14
  • Thank you both - I appreciate it! – Jon Feb 14 '22 at 18:15

0 Answers0