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

Difference between NumericFormat component and numericFormatter function #806

Open
1 of 6 tasks
thiengo105 opened this issue Oct 19, 2023 · 3 comments
Open
1 of 6 tasks

Comments

@thiengo105
Copy link

thiengo105 commented Oct 19, 2023

Describe the issue and the actual behavior

numericFormatter function should return the same value as NumberFormat component with the same props.
image

Describe the expected behavior

numericFormatter should return 3.91 instead of 3.90

Provide a CodeSandbox link illustrating the issue

https://codesandbox.io/p/sandbox/react-number-format-gnsqpq

Provide steps to reproduce this issue

use the following props to pass to numericFormatter function and NumerFormat component:

value = 3.9082;
decimalScale = 2;

Please check the browsers where the issue is seen

  • Chrome
  • Chrome (Android)
  • Safari (OSX)
  • Safari (iOS)
  • Firefox
  • Firefox (Android)
@portare
Copy link

portare commented May 15, 2024

Also numericFormatter doesnt apply mapToRadix property

@RifatF
Copy link

RifatF commented Jun 5, 2024

Same problem with version 5.4.0. The parameter valueIsNumericString doesn't change anything.

@AI111
Copy link

AI111 commented Jun 17, 2024

Here is the reason https://github.com/s-yadav/react-number-format/blob/master/src/numeric_format.tsx#L478
NumericFormat Component round value before formatting it with numericFormatter function

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

No branches or pull requests

4 participants