You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When handling currency values in programming it's recommended to use integer values to avoid calculations and conversion mistakes due to the floating point problem.
So I want to discuss the possibility to have a prop called something like parseAsInteger so the value will be an integer, with the decimals multiplied by their precision.
So when the user input: 12,34 the value should be 1234, if the precision is 2.
If the precision is other like 3, the value 12,345 should be parsed as 12345.
Instead of having to multiply it by 100 by my self I would like to have the value parsed as integer like this.
For instance: 2.22 * 100 == 222 evaluates to false. When I multiply 2.22 by 100, it doesn't return an integer value due to the floating point problem.
I can make a PR but I want to have some feedback on this issue first.
The text was updated successfully, but these errors were encountered:
If you're still interested, I've just published @ericblade/react-currency-input^1.0.2 , which is pretty much identical in function to this repo, right now. there may be some slight behavior changes, and i removed the bits that were deprecated in this repo. I've placed a codepen at https://codepen.io/ericblade/pen/NWaLbGK
Whole thing is in typescript, and builds with the typescript compiler now.
I will be more than happy to continue work there (or if @jsillitoe returns, to hand it back off :) ) and accept pull reqs, and so on.
When handling currency values in programming it's recommended to use integer values to avoid calculations and conversion mistakes due to the floating point problem.
So I want to discuss the possibility to have a prop called something like
parseAsInteger
so the value will be an integer, with the decimals multiplied by their precision.So when the user input: 12,34 the value should be 1234, if the precision is 2.
If the precision is other like 3, the value 12,345 should be parsed as 12345.
Instead of having to multiply it by 100 by my self I would like to have the value parsed as integer like this.
For instance: 2.22 * 100 == 222 evaluates to false. When I multiply 2.22 by 100, it doesn't return an integer value due to the floating point problem.
I can make a PR but I want to have some feedback on this issue first.
The text was updated successfully, but these errors were encountered: