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
Package rounded up the number in case I passed the decimal scale, But this should not happen. In my opinion, the main number should not be changed or should have a new prop to handle the rounding mode.
Describe the expected behavior
consider: <NumericFormat value={0.99813} decimalScale={2} />
It returns an input with the value 1.00 but I expect the final number to be 0.99, I expect it just removes additional decimals, not rounding the main value up.
After tracing it, I discovered a function in the utils file called roundToPrecision, in which the toFixed function is used in this function. Is there a solution to truncate the main number using the decimalScale instead of using the toFixed function?
Hey @hamiidrahmani this is intentional behaviour added on the library to round the value prop, and not allow user to type beyond the provided decimalScale.
There are plans to make API for decimal precisions more equivalent to Intl.NumberFormatand we will introduce maximumSignificantDigits, minimumSignificantDigits and roundingMode prop, using which you can achieve this.
But meanwhile, will suggest to trim the decimal part on consumer land.
Hey @s-yadav, First of all, thanks for your time and consideration.
I want you to know it works properly in version 4.7.3 and I found it after I updated the package. Also, the package is used in a large-scale financial project and It is not reasonable for me to trim the decimal part.
so I have a question: What is your time estimation for implementing these changes?
Describe the issue and the actual behavior
Package rounded up the number in case I passed the decimal scale, But this should not happen. In my opinion, the main number should not be changed or should have a new prop to handle the rounding mode.
Describe the expected behavior
consider:
<NumericFormat value={0.99813} decimalScale={2} />
It returns an input with the value
1.00
but I expect the final number to be0.99
, I expect it just removes additional decimals, not rounding the main value up.Provide a CodeSandbox link illustrating the issue
https://codesandbox.io/p/sandbox/value-demo-forked-y4nw27?file=%2Fsrc%2FApp.js%3A17%2C5
Provide steps to reproduce this issue
Please check the browsers where the issue is seen
The text was updated successfully, but these errors were encountered: