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

Bluring component causes certain currencies to lose most of input #310

Closed
willyls-VG opened this issue Oct 11, 2023 · 2 comments · May be fixed by #379
Closed

Bluring component causes certain currencies to lose most of input #310

willyls-VG opened this issue Oct 11, 2023 · 2 comments · May be fixed by #379
Labels

Comments

@willyls-VG
Copy link

Describe the bug
When entering amounts in JPY or KRW, we lose all but the first two digits on blur. Then padRight(3, '0')

e.g.:

enter: 123456 => result: 120
enter: 1 => result: 100

To Reproduce
Steps to reproduce the behavior:

  1. Create component with this setup:
    value={value1}
    decimalScale={2}
    onValueChange={handleOnValue1Change}
    intlConfig={{ locale: "ja-JP", currency: "JPY" }}
    disableAbbreviations
  2. Enter amount in first input
  3. Enter 12345
  4. Blur from

Expected behavior
See 12,345 in field

Code Sandbox
If applicable, please fork this CodeSandbox template and customise it to replicate your issue.

Additional context

@sspoth
Copy link

sspoth commented Oct 24, 2023

I am getting the same error. The issues seems to be because these currencies are 0 decimal currencies Zero-decimal currencies and the behavior for decimalScale is wrong. Zero-decimal currencies should not have any decimal scale since they don't have fractions so the intlConfig of these should be zero. Now where the bug exists is that for some reason it assumes every value after the first is a decimal so if ur decimalScale is 2 then 123456 => result: 120. however, even if you change your decimal scale to 0, the result will be 123456 => result: 1 because the code is incorrectly interpreting that 23456 are decimal values

@mc-alt
Copy link

mc-alt commented Oct 31, 2023

I am also experiencing this issue with decimalScale: 2 (we have had to disable it for now)

@github-actions github-actions bot added the Stale label Dec 31, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants