title: Input date in react doesn't read default value
body: <p>I have my react app and I have problem with input type date. The app is a book management system and if I want to edit a book, I expect all the inputs to get as default values their current values. It works for every input except the date. I mean - it sees the current date even if I click to change the date, it does have the current date, but in the form it doesn't show, it's like this: <code>dd-mm-rrrr</code></p>
  <p>My input code:</p>
  <pre><code>import React, {useState} from 'react';
  import BooksForm from './BooksForm';
  import {Button, Form} from &quot;react-bootstrap&quot;;
  import {NavLink} from 'react-router-dom';
  import {AiOutlineWarning} from &quot;react-icons/ai&quot;;
  
  const EditBook = (props) =&gt; {
  
  
      const axios=require('axios')
      const [book,setBook] = useState({
          title:  props.location.title ? props.location.title : '',
          author:  props.location.author ? props.location.author : '',
          genre: props.location.genre ? props.location.genre : '',
          release_date: props.location.release_date ? props.location.release_date : '',
          description: props.location.description ? props.location.description : '',
          image_url: props.location.image_url ? props.location.image_url: ''
  
  
  
      })
  
      const [errorMessage, setErrorMessage] = useState('')
  
      const { title,
          author,
          genre,
          release_date,
          description,
          image_url,
          rating_count} = book;
  
      const handleOnEdit = (event) =&gt; {
          console.log(event)
          event.preventDefault();
          const values = [
              title,
              author,
              genre,
              release_date,
              description,
              image_url
          ];
          let errorMessage = '';
  
          const allFieldsFilled = values.every((field) =&gt; {
              const value = `${field}`.trim();
              return value !== '' &amp;&amp; value !== '0' &amp;&amp; value !== undefined;
          });
  
          if (allFieldsFilled) {
              if (new Date(release_date) &gt; new Date()) {
                  errorMessage='Data nie może być starsza niż dzisiejsza'
                  setErrorMessage(errorMessage)
              }
              else {
  
                  const book = {
  
                      title,
                      author,
                      genre,
                      release_date,
                      description,
                      image_url
  
                  };
                  event.preventDefault()
                  axios.put('http://localhost:5000/api/book/'+props.location.id,book);
              }
          } else {
              errorMessage = 'Please fill out all the fields.';
          }
          setErrorMessage(errorMessage);
      };
  
  
  
      const handleInputChange = (e) =&gt; {
          const name = e.target.name
          const value = e.target.value
          setBook((prev) =&gt; ({...prev, [name]: value}));
  
      }
  
  
      const data = props.location.release_date
      function formatDate(date) {
          let d = new Date(date),
              month = '' + (d.getMonth() + 1),
              day = '' + d.getDate(),
              year = d.getFullYear();
  
          if (month.length &lt; 2)
              month = '0' + month;
          if (day.length &lt; 2)
              day = '0' + day;
  
          return [year, month, day].join('-');
      }
  
  
      const dataDobra = formatDate(data)
      console.log(dataDobra)
      return (
      &lt;div className=&quot;form&quot;&gt;
          {errorMessage &amp;&amp; &lt;p className=&quot;errorMsg&quot;&gt;&lt;AiOutlineWarning /&gt;{errorMessage}&lt;/p&gt;}
              &lt;Form onSubmit={handleOnEdit}&gt;
  
  
                  &lt;Form.Group controlId=&quot;nazwa&quot;&gt;
                      &lt;Form.Label&gt;Wprowadź tytuł książki&lt;/Form.Label&gt;
                      &lt;Form.Control className=&quot;control-input&quot; type=&quot;text&quot; name=&quot;title&quot; defaultValue={props.location.title} placeholder=&quot;Tu edytuj tytuł&quot; onChange={handleInputChange} /&gt;
                  &lt;/Form.Group&gt;
  
                  &lt;Form.Group controlId=&quot;autor&quot;&gt;
                      &lt;Form.Label&gt;Wprowadź autora książki&lt;/Form.Label&gt;
                      &lt;Form.Control className=&quot;control-input&quot; type=&quot;text&quot; name=&quot;author&quot; defaultValue={props.location.author} placeholder=&quot;Tu edytuj autora&quot; onChange={handleInputChange} /&gt;
                  &lt;/Form.Group&gt;
  
                  &lt;Form.Group controlId=&quot;genre&quot;&gt;
                      &lt;Form.Label&gt;Wprowadź gatunek książki&lt;/Form.Label&gt;
                      &lt;Form.Control className=&quot;control-input&quot; type=&quot;text&quot; name=&quot;genre&quot; defaultValue={props.location.genre} placeholder=&quot;Tu edytuj gatunek&quot; onChange={handleInputChange} /&gt;
                  &lt;/Form.Group&gt;
  
                  &lt;Form.Group controlId=&quot;releaseDate&quot;&gt;
                      &lt;Form.Label&gt;Wprowadź datę powstania książki&lt;/Form.Label&gt;
                      &lt;Form.Control className=&quot;control-input&quot; type=&quot;date&quot; name=&quot;release_date&quot; value={props.location.release_date} placeholder=&quot;Tu edytuj datę powstania&quot; onChange={handleInputChange} /&gt;
                  &lt;/Form.Group&gt;
  
                  &lt;Form.Group controlId=&quot;description&quot;&gt;
                      &lt;Form.Label&gt;Wprowadź opis książki&lt;/Form.Label&gt;
                      &lt;Form.Control className=&quot;control-input&quot; type=&quot;text&quot; name=&quot;description&quot; defaultValue={props.location.description} placeholder=&quot;Tu zmień opis&quot; size=&quot;30&quot; onChange={handleInputChange} /&gt;
                  &lt;/Form.Group&gt;
  
                  &lt;Form.Group controlId=&quot;imageurl&quot;&gt;
                      &lt;Form.Label&gt;Wprowadź adres URL do zdjęcia książki&lt;/Form.Label&gt;
                      &lt;Form.Control className=&quot;control-input&quot; type=&quot;text&quot; name=&quot;image_url&quot; defaultValue={props.location.image_url} placeholder=&quot;Tu zmień adres do zdjęcia&quot; size=&quot;30&quot; onChange={handleInputChange} /&gt;
                  &lt;/Form.Group&gt;
  
  
  
                  &lt;Button type=&quot;submit&quot; variant=&quot;primary&quot; className=&quot;submitButton bookButtons&quot;&gt;Submit&lt;/Button&gt;
                  &lt;NavLink to=&quot;/&quot;&gt;&lt;Button variant=&quot;info&quot; onClick={props.location.onEdit}&gt;Don't edit&lt;/Button&gt;&lt;/NavLink&gt;
  
  
  
  
  
              &lt;/Form&gt;
      &lt;/div&gt;
      );
  };
  
  export default EditBook;
  </code></pre>