title: How can I convert date string to date object in javascript in yyyy-mm-dd format
body: <p>How can I convert date string to date object in javascript in yyyy-mm-dd format i.e 2021-06-10</p>
  <pre><code>let date = '2021-06-10' //typeof == string
  </code></pre>
  <p>or</p>
  <pre><code>let date = 2021-06-10T00:00:00.000Z  // I want only 2021-06-10 of type date and not string
  </code></pre>
  <p>the typeof must give me date type instead of string. I have tried toString(), toLocaleString() etc etc, all these gives me dates in string , but I have to set the value in form control so this must be of date type.</p>
  <p>Any help!!</p>