Skip to content

isoDate validating yyyy-mm-dd#428

Closed
rtomlinson wants to merge 2 commits intohapijs:masterfrom
rtomlinson:enhancement/isoDate
Closed

isoDate validating yyyy-mm-dd#428
rtomlinson wants to merge 2 commits intohapijs:masterfrom
rtomlinson:enhancement/isoDate

Conversation

@rtomlinson
Copy link

Updated the RegEx to support yyyy-mm-dd, it also removes a defect which allowed strings such as '2013-06-07T14:21:46.295Z0' to pass validation.

This brings it closer to W3s interpretation of ISO 8061 (http://www.w3.org/TR/NOTE-datetime), but is still not strictly compliant.

Richard Tomlinson added 2 commits September 16, 2014 10:36
Signed-off-by: Richard Tomlinson <richard.tomlinson@matchesfashion.com>
Signed-off-by: Richard Tomlinson <richard.tomlinson@matchesfashion.com>
@hueniverse
Copy link
Contributor

@Marsup can your date change using moment going to cover this too? I rather not do any of this work if we are going to include another module.

@hueniverse hueniverse added bug Bug or defect feature New functionality or improvement labels Sep 19, 2014
@hueniverse hueniverse self-assigned this Sep 19, 2014
@Marsup
Copy link
Collaborator

Marsup commented Sep 19, 2014

@hueniverse moment does support ISO 8061 and I don't see any opened issue about it so probably, still the tests in this PR can be interesting to take.

@Marsup
Copy link
Collaborator

Marsup commented Sep 19, 2014

@hueniverse btw isoDate doesn't make any sense on the string type if joi has date, should we keep it ?

@hueniverse
Copy link
Contributor

For now, yeah. Not a great reason for a breaking change. I would keep it but remove it from the docs...

@Marsup
Copy link
Collaborator

Marsup commented Sep 19, 2014

It passes the tests, but it also accepts 2013-06-07T14:21, this looks ok to me, why should it be rejected ?

@hueniverse
Copy link
Contributor

I would rather remove the regex and use moment instead for this too.

@rtomlinson
Copy link
Author

@Marsup W3s interpretation of ISO 8061 doesn't allow for timestamps without a timezone identifier, either Z, to indicate UTC, or an offset are required.

Extending the date functionality and deprecating isoDate seems like a reasonable course to take.

@Marsup
Copy link
Collaborator

Marsup commented Sep 19, 2014

@rtomlinson that might be good you create an issue for that on moment if you really care about it.

@hueniverse
Copy link
Contributor

Going to close this issue. @Marsup can you reference it in your new pr?

@hueniverse hueniverse closed this Sep 19, 2014
@Marsup
Copy link
Collaborator

Marsup commented Sep 19, 2014

Will do. For the record it also validates 2013-06-07T which is wrong as well.

Marsup added a commit to Marsup/joi that referenced this pull request Sep 20, 2014
Marsup added a commit that referenced this pull request Nov 3, 2014
@lock
Copy link

lock bot commented Jan 9, 2020

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.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Bug or defect feature New functionality or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants