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

date().iso() not accepting correct ISO datetime input #1610

Closed
pke opened this issue Oct 10, 2018 · 4 comments
Closed

date().iso() not accepting correct ISO datetime input #1610

pke opened this issue Oct 10, 2018 · 4 comments
Assignees
Labels
non issue Issue is not a problem or requires changes

Comments

@pke
Copy link

pke commented Oct 10, 2018

It seems the date().iso() validation is broken (despite the tests showing it should work).

Context

  • node version: 10.10
  • joi version: 13.7.0
  • environment (node, browser): node
  • used with (hapi, standalone, ...): standalone
  • any other relevant information: used in conjunction with koa-joi-router

What are you trying to achieve or the steps to reproduce ?

iso() does not accept "2018-10-10T10:00Z" as input.

Joi.date().iso().required()

Which result you had ?

error must be a valid ISO 8601 date

What did you expect ?

no error

@WesTyler
Copy link
Contributor

I'm not able to replicate the ValidationError you're seeing with that schema/input combo.

Joi.version
// '13.7.0'

Joi.date().iso().required().validate('2018-10-10T10:00Z')
// error: null

@pke
Copy link
Author

pke commented Oct 10, 2018

Maybe this is an issue with koa-joi-router.
I filed an issue over there too now.
They bundle their own version of Joi but I am loading 13.7.0 in my package.json.
But even with their version I did a router.Joi.validate("2018-10-10T10:00", Joi.date().iso().greater("now")) and it yielded no error.
However when running a server request against the router it is throwing an error.
But we will probably need to discuss it over here as it does not seem to be an issue with joi in general.

@pke pke closed this as completed Oct 10, 2018
@WesTyler
Copy link
Contributor

Feel free to reopen this if the discussion there does end up pointing to an issue over here :)

@WesTyler WesTyler self-assigned this Oct 10, 2018
@WesTyler WesTyler added the non issue Issue is not a problem or requires changes label Oct 10, 2018
@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
non issue Issue is not a problem or requires changes
Projects
None yet
Development

No branches or pull requests

2 participants