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

Pasting a value containing a space results in NaN (or error in IE11) #85

Open
ryanggrey opened this issue Jul 10, 2017 · 4 comments
Open
Labels

Comments

@ryanggrey
Copy link
Contributor

Reported by user. I haven't tried replicating this. Probably worth checking if issue exists in other browsers too.

@ryanggrey ryanggrey added the bug label Jul 10, 2017
@ggovan
Copy link
Contributor

ggovan commented Jul 13, 2017

In helpers.parseString each character of a pasted string is checked to see if it is a number or not. Confusingly isNaN(' ') returns false, i.e. ' ' is a number. MDN has a list of exmaples of things that are considered numbers.

Leading and trailing spaces are kept in the string when trying to parse it as a number, but these don't cause any issues, only spaces in the middle.

What should the behaviour be here? Should pasting 1 23.45 be 123.45, 1, invalid?

Slightly related - when pasting 12.34.56, this gets parsed as 12.34.

@ggovan
Copy link
Contributor

ggovan commented Jul 19, 2017

Looks like this has been fixed in 1.1.1. Pasting 12.34.56 still gives 12.34, but I can live with that.

@ggovan
Copy link
Contributor

ggovan commented Jul 20, 2017

Related - pasting 1a2b3c4d gives 1,234,000,000,000.00

@ggovan
Copy link
Contributor

ggovan commented Jul 20, 2017

Pasting te xt or any text with spaces gives 0.00.

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