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

RangeError thrown when calling toCurrencyFormat() with value without period and mantissaLength = 0 #62

Closed
EstebanCardenas opened this issue Oct 1, 2021 · 1 comment

Comments

@EstebanCardenas
Copy link

Whenever a value without period is sent and the mantissaLength prop is set to 0, a RangeError is thrown.

Example:

toCurrencyString('2545', mantissaLength: 0)

Expected:

2,545

Instead RangeError is thrown.

image

This is because line 565 returns -1 since there are no periods in the value, and then line 566 attempts to take a substring from 0 to -1.

@caseyryan
Copy link
Owner

Thanks. Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants