Good day , I would just like to ask How do we check if a date is valid in javascript the format of the dates are always like the example below. Thanks.
startDate: "2022-1-28"
>Solution :
You can simply use moment.js to check if your date is valid with the given format.
const date = moment('2022-1-28', 'YYYY-MM-DD');
date.isValid(); // false