Created
July 6, 2016 13:53
-
-
Save YurePereira/9dbcb5e19dcc348b15cfabe67ec5d090 to your computer and use it in GitHub Desktop.
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
| /** | |
| * Função que faz a validação de DATA verificando se ela está no formato mm/dd/aaaa, assim retornando TRUE caso esteja | |
| * e FALSE caso contrario. | |
| */ | |
| function validateDateBrazil(c) { | |
| if (c.match(/^[0-9]{1,2}\/[0-9]{1,2}\/[1-9]{1}[0-9]{3}$/)){ | |
| var day = c.replace(/([0-9]{1,2})\/[0-9]{1,2}\/[0-9]{4}/,'$1'), | |
| month = c.replace(/[0-9]{1,2}\/([0-9]{1,2})\/[0-9]{4}/,'$1'), | |
| year = c.replace(/[0-9]{1,2}\/[0-9]{1,2}\/([0-9]{4})/,'$1'); | |
| return ((day >= 1 && day <= 31) && (month >= 1 && month <= 12) && (year > 0)) ? true : false; | |
| } else { | |
| return false; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment