Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The validator accepts ISO 8601 dates which include "%Y-%m-%d" and "%Y-%m-%d %H:%M". The validator makes use of Date.parse() to parse the date before checking if the date is invalid (e.g. 2015-02-29). The built-in Date.parse() function interprets "%Y-%m-%d" dates in GMT but "%Y-%m-%d %H:%M" in the user's timezone. This caused the validator to apply an incorrect timezone offset which then caused it to get out of sync with the built-in Date.parse() function. Because of this mismatch, certain dates such as 2011-12-21 were being marked as invalid when the user had a timezone offset < 0, e.g. in PST, since the date would become 2011-12-20 after the incorrect timezone offset was applied. This fixes the function that determines the timezone in the date. It now checks for the special "%Y-%m-%d" case and returns a timezone offset of 0 (GMT). cc #480
- Loading branch information