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

Fix decimal scale issue #501

Merged
merged 8 commits into from
Mar 15, 2021
Merged

Fix decimal scale issue #501

merged 8 commits into from
Mar 15, 2021

Conversation

nikhil-varma
Copy link
Collaborator

@nikhil-varma nikhil-varma commented Mar 13, 2021

Describe the issue/change

This PR fixes decimal scale issue. Ref issue linked in this PR

Add CodeSandbox link to illustrate the issue (If applicable)

https://codesandbox.io/s/material-demo-forked-6jcgb?file=/demo.js:0-2546

Describe specs for failing cases if this is an issue (If applicable)

When a value like 123.15 is passed, the final value returned and assigned to the input is 123.14. This is happening because of the toFixed method causing a floating point issue.

Describe the changes proposed/implemented in this PR

This fix ensure that the scale is capped only when the decimal value overshoots the scale value

Link Github issue if this PR solved an existing issue

Fix for : #495

Example usage (If applicable)

N/A

Screenshot (If applicable)

N/A

Please check which browsers were used for testing

  • Chrome
  • Chrome (Android)
  • Safari (OSX)
  • Safari (iOS)
  • Firefox
  • Firefox (Android)

@nikhil-varma nikhil-varma changed the title chore: Add failed test case to validate issue Fix decimal scale issue Mar 13, 2021
@nikhil-varma nikhil-varma self-assigned this Mar 13, 2021
@nikhil-varma nikhil-varma marked this pull request as ready for review March 14, 2021 15:01
src/utils.js Outdated Show resolved Hide resolved
test/library/input.spec.js Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants