-
Notifications
You must be signed in to change notification settings - Fork 187
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(toDecimal): teach toDecimal
how to handle negative units
#690
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 8890d00:
|
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.
Great catch, thank you!
One small change and we'll be good to go.
toDecimal
how to handle negative units
Previously, toDecimal would format an amount like -1050 as '-10.-50', when we'd expect '-10.50'. We now use the absolute value of all but the first unit when building the decimal string.
5634d43
to
8890d00
Compare
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.
LGTM 🚀
Change dinerojs#690 fixed the general case of formatting negative unit values, but was one remaining case where formatting was still incorrect: when the first unit is -0, the resulting string didn't include the leading negative sign. This change identifies that exact case (negative value, leading zero) and pads the resulting string with a leading negative sign. Fixes dinerojs#692
Change dinerojs#690 fixed the general case of formatting negative unit values, but was one remaining case where formatting was still incorrect: when the first unit is -0, the resulting string didn't include the leading negative sign. This change identifies that exact case (negative value, leading zero) and pads the resulting string with a leading negative sign. Fixes dinerojs#692
Change dinerojs#690 fixed the general case of formatting negative unit values, but was one remaining case where formatting was still incorrect: when the first unit is -0, the resulting string didn't include the leading negative sign. This change identifies that exact case (negative value, leading zero) and pads the resulting string with a leading negative sign. Fixes dinerojs#692
Change dinerojs#690 fixed the general case of formatting negative unit values, but was one remaining case where formatting was still incorrect: when the first unit is -0, the resulting string didn't include the leading negative sign. This change identifies that exact case (negative value, leading zero) and pads the resulting string with a leading negative sign. Fixes dinerojs#692
Change #690 fixed the general case of formatting negative unit values, but was one remaining case where formatting was still incorrect: when the first unit is -0, the resulting string didn't include the leading negative sign. This change identifies that exact case (negative value, leading zero) and pads the resulting string with a leading negative sign. Fixes #692 Co-authored-by: Sarah Dayan <[email protected]>
Previously, toDecimal would format an amount like -1050 as '-10.-50', when we'd expect '-10.50'. We now use the absolute value of all but the first unit when building the decimal string.