Checking the Date Format using RegEx

RegEx -> Regular Expression.

RegEx is the regular expression object with predefined properties and methods in JavaScript we can use in suiteScript too.

function:

function validateDate(testdate) {

let dateRegex = /^d{2}/d{2}/d{4}$/;

return dateRegex.test(testdate);

}

return {

validateDate: validateDate

};

Leave a comment

Your email address will not be published. Required fields are marked *