Last active
June 20, 2020 23:01
-
-
Save midnite81/b0dd6ff8c6b28eb68f2b24c7e57677e6 to your computer and use it in GitHub Desktop.
A bit of javascript to see if a date is in English format or not
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkEnglishDateJs(subject) { | |
var pattern = new RegExp('/([0-2]\d|3[0-1])\/(0\d|1[0-2])\/(20)\d{2}/'); | |
return pattern.test(subject); | |
} | |
if (checkEnglishDateJs('01/02/2019')) { | |
alert('true'); | |
} else { | |
alert('false'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment