We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm trying to validate a positive number, and I expect ".30" to be valid since isNan(".30") == false.
Joi.number().validate(".30")
error: ValidationError: "value" must be a number
error to be null
Please let me know if you need any additional information.
The text was updated successfully, but these errors were encountered:
I'm not able to reproduce:
$ node -v v8.6.0
Joi.number().validate('0.30'); /* { error: null, value: 0.3, then: [Function: then], catch: [Function: catch] } */ Joi.version // '15.0.2'
Sorry, something went wrong.
Thanks for the quick response, @WesTyler.
Joi.number().validate('0.30') works, but Joi.number().validate('.30') doesn't.
Joi.number().validate('0.30')
Joi.number().validate('.30')
Oh geez, my bad. Sorry, didn't notice I habitually typed the leading 0
0
Looks like the leading decimal is messing with the regex before trying to convert here
3ad8cb1
hueniverse
No branches or pull requests
Context
What are you trying to achieve or the steps to reproduce ?
I'm trying to validate a positive number, and I expect ".30" to be valid since isNan(".30") == false.
Which result you had ?
error: ValidationError: "value" must be a number
What did you expect ?
error to be null
Please let me know if you need any additional information.
The text was updated successfully, but these errors were encountered: