-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Date.iso() does not interpret ISO-8601 dates correctly #687
Comments
This is not a huge problem until someone tries to validate a following string: |
Joi converts anything that looks like an integer into one, assuming it's a unix timestamp, it's a design choice, if you don't agree with it you can always set the strict mode. EDIT: strict mode will actually fail every time with a string, so you either agree with the choice, or use Joi.string().isoDate() and parse it yourself. |
Thanks for the fix. Is |
Yep, it's published and working as expected. The |
It always has been, I just remembered it was not documented. |
If you ever find a way to make it work whatever the format, feel free to submit a patch or the steps to follow. |
Yep, I'm thinking of it. |
If this behaviour is by design, can this issue be closed? |
I don't think we'll ever come to a fix for this one. |
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions. |
Run the above with nodejs. It prints:
Thu Jan 01 1970 10:55:33 GMT+1000 (AEST)
Whereas the date should be
3333-11-29
. See ISO standard Ordinal Dates section.Additionally,
"3333-333"
should be parsed to3333-11-29
too. But we get an error:message: '"value" must be a valid ISO 8601 date'
.A side note.
moment.js does a better job parsing
"3333-333"
correctly. But it fails to parse"3333333"
.The text was updated successfully, but these errors were encountered: