ianmcnally / react-currency-masked-input

Input masking for currency, in React
MIT License
91 stars 24 forks source link

Period (".") should be a disallowed character #9

Open holdenmatt opened 8 years ago

holdenmatt commented 8 years ago

Your component works great, thanks!

One bug I've seen: entering a period causes weird behavior. E.g.:

I'd expect "." to be a disallowed character like any other non-digit character.

ianmcnally commented 8 years ago

thanks for the report @holdenmatt! i'll take a peek at this, and i'd also welcome a pull request!

ianmcnally commented 8 years ago

or a failing test would be helpful 😁 . my test case didn't catch it: https://github.com/ianmcnally/react-currency-masked-input/blob/master/test/react-currency-masked-input_spec.js#L208-L215

nratter commented 8 years ago

+1 for this.

ianmcnally commented 8 years ago

I'm happy to see support for the bug, but please refrain from +1s. Github's thumbs up reactions will suffice for me.

As to the actual bug, it looks like a hard problem. The browser doesn't pass along the extra period in the value on change, and it allows periods since a number input may have periods.