title: How to convert data yyyy-mm-dd to dd/mm/yyyy in ReactJS?
body: <p>I'm beginner in ReactJS and I'm trying to save some dates fields.</p>
  <p>By default, the dates are save in format <code>yyyy-MM-dd</code>, but when I able to send the date for the API the format should be in format <code>dd/mm/yyyy</code>.</p>
  <p>I already try using <code>.toLocaleDateString('pt-BR', {timeZone: 'UTC'});</code>. But when I did that, return error:</p>
  <pre><code>The specified value &quot;19/8/2020&quot; does not conform to the required format, &quot;yyyy-MM-dd&quot;.
  </code></pre>
  <p>Here's my code I put in <a href="https://codesandbox.io/s/relaxed-thunder-ecd71?file=/src/components/NewUser/NewUser.jsx" rel="nofollow noreferrer">CodeSandBox</a></p>
  <p>And, here where I get the date values:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import React, { useState } from "react";
  
  const NewUser = () =&gt; {
    const [data, setData] = useState({
      birthdate: "",
      admission_date: ""
    });
  
    const changeField = (field, value) =&gt; {
      const auxData = { ...data };
      auxData[field] = value;
      setData(auxData);
    };
  
    return (
      &lt;div&gt;
        &lt;span&gt;Born&lt;/span&gt;
        &lt;input
          id="birthdate"
          type="date"
          value={data.birthdate}
          onChange={(event) =&gt; changeField("birthdate", event.target.value)}
        /&gt;
        &lt;div /&gt;
        &lt;span&gt;Admission Date&lt;/span&gt;
        &lt;input
          id="admission_date"
          type="date"
          value={data.admission_date}
          onChange={(event) =&gt; changeField("admission_date", event.target.value)}
        /&gt;
      &lt;/div&gt;
    );
  };
  
  export default NewUser;</code></pre>
  </div>
  </div>
  </p>