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

isFloat returns false for "-.01" #618

Closed
mdj128 opened this issue Jan 25, 2017 · 1 comment
Closed

isFloat returns false for "-.01" #618

mdj128 opened this issue Jan 25, 2017 · 1 comment
Labels

Comments

@mdj128
Copy link

mdj128 commented Jan 25, 2017

validator.isFloat("-.01") = false. I'm using version 6.2.0 currently, didn't know if this is expected or has been reported already.

@chriso chriso added the 🐛 bug label Feb 1, 2017
@chriso
Copy link
Collaborator

chriso commented Feb 1, 2017

Thanks for the report.

Given that -.01 is allowed as a literal and is accepted by parseFloat I think it's ok:

> -.01
-0.01
> parseFloat('-.01')
-0.01

Also it looks like isFloat('.01') is true so this is inconsistent behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants