1 if (date.match(/^\d{4}-\d{2}-\d{2}$/) === null) {
2 //it is not a date with format YYYY-MM-DD
3 }
4else
5 //it is a date with format YYYY-MM-DD
1var date_regex = /^(0[1-9]|1[0-2])\/(0[1-9]|1\d|2\d|3[01])\/(19|20)\d{2}$/;
2if (!(date_regex.test(testDate))) {
3 return false;
4}