-
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): preserve negative sign for leading zeros #693
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 4eed6c3:
|
5e78040
to
0961248
Compare
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
0961248
to
69cd891
Compare
Given that ( I think this results in a simpler solution overall that only uses a single top-level branch (to determine if we need to add the leading negative). |
@jparise it reads very clearly to me. |
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.
Excellent rewrite! A few suggestions and we'll be good to go.
Co-authored-by: Sarah Dayan <[email protected]>
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.
Awesome contribution, thanks @jparise!
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