-
Notifications
You must be signed in to change notification settings - Fork 25
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
Issue with date validation with format() #39
Comments
Maybe the problem refers to this line: you're passing an integer and maybe that
Just pass '1' instead of the number, something like |
When we made the change to ES6 import we admittedly made a best guess as to the way to extend Joi with the joi-date extension. There is simply nothing in the Joi docs on how to do it using the ES6 syntax. Thankfully we tracked down this issue hapijs/joi-date#39 (comment) which included how they had used `@joi/date` with Joi to extend it. So, this updates our code to match and resolve the error we were getting (essentially Joi was not recognising our date formats).
When we made the change to ES6 import we admittedly made a best guess as to the way to extend Joi with the joi-date extension. There is simply nothing in the Joi docs on how to do it using the ES6 syntax. Thankfully we tracked down this issue hapijs/joi-date#39 (comment) which included how they had used `@joi/date` with Joi to extend it. So, this updates our code to match and resolve the error we were getting (essentially Joi was not recognising our date formats).
thank you |
Support plan
Context
What are you trying to achieve or the steps to reproduce?
I was trying to validate a date on a particular form that I'm working on, but the problem is there's an edge case where it says
1
is a valid date. I also tried some numbers, the biggest that I got validated is275760
until it got adate.base
error. Take note that I usedformat()
just to handle this edge case but it doesn't work as expected.What was the result you got? It says date with value 1 is valid
What result did you expect? It should be invalid, following the rules of
format()
The text was updated successfully, but these errors were encountered: