//birth date validation
function validateBirthDate(birthDate) {
//create regex for birth date
const regex = /^(0[1-9]|1[0-2])\/(0[1-9]|1\d|2\d|3[01])\/(19|20)\d{2}$/;
//return true if birth date is valid
return regex.test(birthDate);
}
//example
const result = validateBirthDate("01/01/2020");
//output
console.log(result); //true
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)