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