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

Number validation fails with "1E3" #2097

Closed
kanongil opened this issue Sep 3, 2019 · 0 comments
Closed

Number validation fails with "1E3" #2097

kanongil opened this issue Sep 3, 2019 · 0 comments
Assignees
Labels
bug Bug or defect
Milestone

Comments

@kanongil
Copy link
Contributor

kanongil commented Sep 3, 2019

Context

  • joi version: 15.1.1 & HEAD

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

const schema = Joi.number();

schema.validate('1e3'); // => { value: 1000 }
schema.validate(1E3); // => { value: 1000 }
schema.validate('1E3'); // fails

Which result you had ?

{
  value: 1000,
  error: [Error [ValidationError]: "value" must be a safe number] {
    _original: '1E3',
    details: [ [Object] ]
  }
}

What did you expect ?

 { value: 1000 }
@hueniverse hueniverse self-assigned this Sep 8, 2019
@hueniverse hueniverse added the bug Bug or defect label Sep 8, 2019
@hueniverse hueniverse added this to the 16.0.0 milestone Sep 8, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Mar 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug or defect
Projects
None yet
Development

No branches or pull requests

2 participants