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

[Bug]: Input after 17 digit converts to 0 after loosing focus in Currency widget #20075

Open
1 task done
chandannkumar opened this issue Jan 25, 2023 · 12 comments
Open
1 task done
Assignees
Labels
Bug Something isn't working Currency Input Widget Issues related to currency input widget Low An issue that is neither critical nor breaks a user flow Needs Triaging Needs attention from maintainers to triage Production Widgets & Accelerators Pod Issues related to widgets & Accelerators Widgets Product This label groups issues related to widgets

Comments

@chandannkumar
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Description

The inputs after 17 digits are getting converted to 0 automatically in Currency Input widget

Steps To Reproduce

  1. Drag & Drop Currency Input widget
  2. Type in input with more 17 digits
  3. Click outside of the currency widget
  4. Observe that number after 17 digits got converted to 0

Public Sample App

No response

Issue video log

https://bthrujcsw8.vmaker.com/record/ladRprnBm6LCU28A

Version

Cloud / Production

@chandannkumar chandannkumar added Bug Something isn't working Needs Triaging Needs attention from maintainers to triage labels Jan 25, 2023
@chandannkumar chandannkumar added High This issue blocks a user from building or impacts a lot of users Currency Input Widget Issues related to currency input widget labels Jan 25, 2023
@github-actions github-actions bot added the Widgets Product This label groups issues related to widgets label Jan 25, 2023
@MuhammadAakash
Copy link
Contributor

Hi @chandannkumar
I would like to work on this issue.

@dilippitchika
Copy link
Contributor

Hello @MuhammadAakash can you please explain how you are thinking about the solution to this problem?

@MuhammadAakash
Copy link
Contributor

Hi @dilippitchika
First of all, I will figure out why this is happening, maybe there will be any type of validation of the length of numbers or the Currency widget is configured to only allow a certain number of digits.
If that is the case then i will remove that validation so it accepts if there are more than 17 digits in the input field

@MuhammadAakash
Copy link
Contributor

@dilippitchika
If you think there is any other better solution.
I would like to hear from you and then will start working according to that.

@dilippitchika
Copy link
Contributor

@MuhammadAakash what do you think should be limit if you now remove the 17 digit limit?

@MuhammadAakash
Copy link
Contributor

@dilippitchika
I think no limit because it totally depends on the user that how many digits he/she likes to enter.

@dilippitchika
Copy link
Contributor

Then i believe the problem will be in how large numbers are processed in JS. I think the 17 digit limit is already too large. Can you first investigate why there's a 17 digit limit?

@MuhammadAakash
Copy link
Contributor

MuhammadAakash commented Jan 25, 2023

@dilippitchika
Yeah sure I am cloning the repository, then I will start figuring out this limit.

@MuhammadAakash
Copy link
Contributor

@dilippitchika
I have just visited the code and I found that where is the error
When the focus of input changes this function executes handleFocusChange and in this function, we are calling this function getLocaleThousandSeparator to add a thousand separators in the value,
function getLocaleThousandSeparator() { return Intl.NumberFormat(getLocale()) .format(11111) .replace(/\p{Number}/gu, ""); }

JavaScript's Number.MAX_SAFE_INTEGER is 9007199254740991 and 123456789123456789123 is much larger than that, so when passing this number to the Intl.NumberFormat will truncate the number and format it accordingly.

This means that any digits beyond the 17th digit will be truncated and not considered in the final value

@dilippitchika
Copy link
Contributor

Thanks for the triaging on this @MuhammadAakash really appreciate it, i don't think we need to fix today this as it's very unlikely to have a currency with 17 digits without decimals. I suggest we park this feature for now.

@MuhammadAakash
Copy link
Contributor

@dilippitchika
Sure.

@dilippitchika dilippitchika added Low An issue that is neither critical nor breaks a user flow and removed High This issue blocks a user from building or impacts a lot of users labels Feb 15, 2023
@dilippitchika
Copy link
Contributor

Setting to low as people won't be facing this in a real scenario

@Nikhil-Nandagopal Nikhil-Nandagopal added the Widgets & Accelerators Pod Issues related to widgets & Accelerators label Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Currency Input Widget Issues related to currency input widget Low An issue that is neither critical nor breaks a user flow Needs Triaging Needs attention from maintainers to triage Production Widgets & Accelerators Pod Issues related to widgets & Accelerators Widgets Product This label groups issues related to widgets
Projects
None yet
Development

No branches or pull requests

5 participants