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
fix: number format converting to decimals #13465
fix: number format converting to decimals #13465
Conversation
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed within 3 days if no further activity occurs, but it only takes a comment to keep a contribution alive :) Also, even if it is closed, you can always reopen the PR when you're ready. Thank you for contributing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hasnain2808 Please add screenshots or animated GIFs for UI-related fixes.
It helps the reviewer or QA rep to get the context of the fix.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed within 3 days if no further activity occurs, but it only takes a comment to keep a contribution alive :) Also, even if it is closed, you can always reopen the PR when you're ready. Thank you for contributing. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed within 3 days if no further activity occurs, but it only takes a comment to keep a contribution alive :) Also, even if it is closed, you can always reopen the PR when you're ready. Thank you for contributing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hasnain2808 the fix should ideally be in the parse
function in float.js
to avoid such conversions on repeated validation.
@hasnain2808 any update on this? |
@surajshetty3416 I went through all our control files and found out that the parse, flt, format_number are doing their jobs fine parse method takes the number format(or figures it out) parameter using which it determines the identifiers for decimals and group separators The problem that was coming was because the lines I removed were calling the parse method and setting the value in the model. parse method's job is to find the actual number from the formatted number setting this in the model is incorrect. the change method calls format number before setting the value in the model Next time we call the parse method it again gets the number format but this time the number is not formatted with the number format rather it is in normal js float hence it tries to parse it using the shared number format and messes it up Another interesting block is this Hence IMO the focus implementation was incorrect and repeated calls to parse and format number would yield correct results. Thanks |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed within 3 days if no further activity occurs, but it only takes a comment to keep a contribution alive :) Also, even if it is closed, you can always reopen the PR when you're ready. Thank you for contributing. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed within 3 days if no further activity occurs, but it only takes a comment to keep a contribution alive :) Also, even if it is closed, you can always reopen the PR when you're ready. Thank you for contributing. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed within 3 days if no further activity occurs, but it only takes a comment to keep a contribution alive :) Also, even if it is closed, you can always reopen the PR when you're ready. Thank you for contributing. |
@Mergifyio backport version-13-hotfix |
Command
|
Issue
For number formats with commas used as decimals on click the number got converted to using dot as decimal. Even in view mode (after save)
This was happening since validate was getting called on focusout
Solution
No need to call validate on focus out since we already call it on change
Before
After: