Converting a string to a date in JavaScript

·

1 min read

Assuming your date has a proper format parse a string to the date object.

new Date(your_string);

var date = new Date("2021-12-12");
console.log(date);