-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 returns true for an invalid iso8601 date #2003
Comments
@rubiin Can I work on this issue? |
@sahilsuman933 sure jump ahead. Before you do, read the contribution guidelines though |
@rubiin Sure. |
@rubiin I was validating the test cases for the iso8601, and many of them are incorrectly placed. For example, 2009-222 is not a valid ISO8601 date but is put in the validISO8601. Also, there is no need for isValidDate function cause there we can already use the inbuilt !isNaN(Date.parse) method to validate whether it is a valid date. One more thing, I think there is no need for a strict separator. So I was thinking of re-writing the whole new ISO8601 code. So can I go ahead and do it? |
Sure. As long as the tests are properly written and the logic defines the code |
What's the status of this issue? I'd like to pick it up. |
You cam @spamguy |
@spamguy are you working on this or may I work on it? |
@eric-kingu you can take this provided you complete this first |
@rubiin according to the ISO pdf and the validISO8601 const, this isn't a bug due to the ".000" part of the string representing a fraction of a minute. |
@eric-kingu Go ahead. I got close but getting any closer would have required starting over. |
@eric-kingu @rubiin Can I work on this issue? |
@karthikks26 go for it |
Describe the bug
When using isISO8601 to check date that looks like iso8601 format, but missing seconds, will return true even though it is an invalid date
Examples
Date string such as "2018-09-11T10:16.000Z" will return true.
Live sample: https://codesandbox.io/s/wandering-fire-qr6fm6?file=/src/index.js
Additional context
Validator.js version: 13.7.0
Node.js version: 16
OS platform: macOS
The text was updated successfully, but these errors were encountered: