Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isISO8601 allows non-existent dates #772

Closed
LordSputnik opened this issue Dec 31, 2017 · 3 comments · Fixed by #910
Closed

isISO8601 allows non-existent dates #772

LordSputnik opened this issue Dec 31, 2017 · 3 comments · Fixed by #910
Assignees

Comments

@LordSputnik
Copy link

isISO8601 currently passes non-existent dates such as "2017-06-31" and "2017-02-29". If the day of the month is provided, it should be checked to make sure it's actually valid for the supplied month and year.

@deniercounter
Copy link

deniercounter commented Mar 19, 2018

Ah yes, I was surprised too, that 31. February 2012 became "Fri Mar 02 2012 00:00:00 GMT+0100 (Mitteleuropäische Zeit) {}"

which btw is the same one receives from new Date("2012-02-31")

@profnandaa
Copy link
Member

On it 👍

profnandaa added a commit to profnandaa/validator.js that referenced this issue Oct 14, 2018
This commit adds an additional test for dates
over and above passing the pattern match.

It checks to assertain that the date is a
valid date. For examples, dates like
2009-02-29 are caught as invalid.

Additionally, it also fixes a minor bug
with the `weekDate` that was wrongfully
leaving out W53 as an invalid date.

fixes validatorjs#772
profnandaa added a commit to profnandaa/validator.js that referenced this issue Oct 14, 2018
This commit adds an additional test for dates
over and above passing the pattern match.

It checks to assertain that the date is a
valid date. For examples, dates like
2009-02-29 are caught as invalid.

Additionally, it also fixes a minor bug
with the `weekDate` that was wrongfully
leaving out W53 as an invalid date.

fixes validatorjs#772
@profnandaa
Copy link
Member

@LordSputnik @deniercounter - I've raised the PR, let me know what you think - #910

profnandaa added a commit that referenced this issue Oct 15, 2018
* fix: extra validation for dates

This commit adds an additional test for dates
over and above passing the pattern match.

It checks to assertain that the date is a
valid date. For examples, dates like
2009-02-29 are caught as invalid.

Additionally, it also fixes a minor bug
with the `weekDate` that was wrongfully
leaving out W53 as an invalid date.

fixes #772

* fix: add extra validation for ordinal dates

- adds provision for ordinal dates
- checks that ordinal dates are also valid for leap years
- includes regression tests for previous cases with `strict = false`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants