Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[feature] Check whether input is date before checking if format is array #3530
referenced this pull request
Oct 26, 2016
Your test logic is good, but you cannot pass strings other than ISO8601 Extended with Offset to the date constructor and get a reliable result. The format you are using is not a defined format, thus each browser may parse it differently. While it works on a machine with a US locale, it may be parsed as invalid in any country using DD/MM/YYYY format.
Instead, use explicit syntax when constructing your test dates: