mercredi 18 février 2015

Checking if any given string is a valid date


Does anyone know of any way to check if strings are valid dates? I'm trying to block against invalid dates, while not forcing any kind of date format. Basically here's the problem:



!!Date.parse('hello 1') === true


Javascript can figure out a date from that string, therefore, it's a date. I'd rather it not be. Anyone?





Aucun commentaire:

Enregistrer un commentaire