How can I convert date string to date object in javascript in yyyy-mm-dd format i.e 2021-06-10
let date = '2021-06-10' //typeof == string
or
let date = 2021-06-10T00:00:00.000Z // I want only 2021-06-10 of type date and not string
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.
Any help!!