Skip to content

Instantly share code, notes, and snippets.

@Villanuevand
Created January 1, 2018 21:41
Show Gist options
  • Save Villanuevand/a765c9a617f08a965dc14bfd75e92803 to your computer and use it in GitHub Desktop.
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.
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