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 returns true for an invalid iso8601 date #2003

Open
maxywk opened this issue Jul 18, 2022 · 13 comments
Open

isISO8601 returns true for an invalid iso8601 date #2003

maxywk opened this issue Jul 18, 2022 · 13 comments

Comments

@maxywk
Copy link

maxywk commented Jul 18, 2022

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

@sahilsuman933
Copy link

@rubiin Can I work on this issue?

@rubiin
Copy link
Member

rubiin commented Jul 24, 2022

@sahilsuman933 sure jump ahead. Before you do, read the contribution guidelines though

@sahilsuman933
Copy link

@rubiin Sure.

@sahilsuman933
Copy link

@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?

@rubiin
Copy link
Member

rubiin commented Jul 27, 2022

Sure. As long as the tests are properly written and the logic defines the code

@spamguy
Copy link

spamguy commented Jun 13, 2024

What's the status of this issue? I'd like to pick it up.

@rubiin
Copy link
Member

rubiin commented Jun 13, 2024

You cam @spamguy

@eric-kingu
Copy link

@spamguy are you working on this or may I work on it?

@rubiin
Copy link
Member

rubiin commented Aug 10, 2024

@eric-kingu you can take this provided you complete this first

@eric-kingu
Copy link

@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.

@spamguy
Copy link

spamguy commented Aug 12, 2024

@eric-kingu Go ahead. I got close but getting any closer would have required starting over.

@karthikks26
Copy link

@eric-kingu @rubiin Can I work on this issue?

@rubiin
Copy link
Member

rubiin commented Sep 27, 2024

@karthikks26 go for it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants