cutTrailingZeros prop added to the component #614
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