Created
January 1, 2018 21:41
-
-
Save Villanuevand/a765c9a617f08a965dc14bfd75e92803 to your computer and use it in GitHub Desktop.
Función que verifica si una fecha ingresada con formato "dd/MM/YYYY" es correcta.
This file contains 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 ddMMYYYYValidator (date) { | |
let _date = date.replace(/[/]/g,'-'); | |
let formatedDate = new Date( _date.replace( /(\d{2})-(\d{2})-(\d{4})/, "$2/$1/$3")); | |
return (isNaN(Date.parse(formatedDate)) ? false : true); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment