-
Notifications
You must be signed in to change notification settings - Fork 415
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
cutTrailingZeros prop added to the component #614
Open
IGrobenskiTT
wants to merge
6
commits into
s-yadav:dev
Choose a base branch
from
IGrobenskiTT:trailing-zeros-prop
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cutTrailingZeros (number) => if passed, then it will look for, and cut, ALL trailing zeros , stopping at cutTrailingZeros decimal point. So cutTrailingZeros is also used to determine the number of decimal places to leave intact when cutting trailing zeros . It's up to user, currently, to bear in mind the decimalScale value (if used) to not exceed its value. Currently, in case both decimalScale and cutTrailingZero props are used, if cutTrailingZero > decimalScale and fixedDecimal is used, it will display cutTrailingZero amount of decimals instead of decimalScale amount of decimals. examples where this is usefull: if 123,456.780 and cutTrailingZeros = 2 then the result will be => 123,456.78 but if 123,456.780 and cutTrailingZeros = 3 then the result will be => 123,456.780 .
cut trailing zeros - on blur support added - now trailign zeros can be cut on Blur as well (previously it was only on change which is not always desired, now both events are possible!- use the one you need)
👍 |
can this be merged to DEV? |
flag allows you to chose between rounding (when using decimal scale) and no rounding. Default value is true (with rounding based on decimal and fixed scale passed). If false, it won't round. The rest of the logic still applies (cutting trailing zeros, other formattings..)
i would really like to have this feature |
so useful ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
added new prop => cutTrailingZeros (number) => if passed, then it will look for, and cut, ALL trailing zeros in the decimal part of the number, stopping at cutTrailingZeros decimal point.
So, in code, cutTrailingZeros is also used to determine the number of decimal places to leave intact when cutting trailing zeros. It's up to the developer, currently, to take care that the cutTrailingZeros prop's value isn't greater than decimalScale value (if such is used)
In case both decimalScale and cutTrailingZero props are used, if cutTrailingZero > decimalScale and fixedDecimal is used, it will display cutTrailingZero amount of decimals instead of decimalScale amount of decimals.
examples where this prop might be useful:
e.g. 123,456.780 and cutTrailingZeros = 2 (because let's say that, while cutting trailing zeros, we still do want to keep at least 2 decimals and cut all trailing zeros after 2nd decimal place) then the result will be => 123,456.78
but if 123,456.780 and cutTrailingZeros = 3 (because let's say that, while cutting trailing zeros, we still do want to keep at least 3 decimals and cut all trailing zeros after 3rd decimal place) then the result will be => 123,456.780 .
Github issue that this PR solves: #611
Works in all browsers