Repository navigation
Update usage of Intl.NumberFormat options - #1791
Merged
Merged
Conversation
Contributor
Author
|
@mollykreis since you're somewhat familiar with this code, would you mind buddying it? |
mollykreis
reviewed
Jan 30, 2024
mollykreis
approved these changes
Jan 31, 2024
m-akinc
marked this pull request as ready for review
January 31, 2024 21:06
rajsite
reviewed
Jan 31, 2024
rajsite
reviewed
Jan 31, 2024
jattasNI
requested changes
Jan 31, 2024
m-akinc
marked this pull request as draft
February 1, 2024 18:23
m-akinc
marked this pull request as ready for review
February 23, 2024 18:51
rajsite
reviewed
Feb 23, 2024
rajsite
approved these changes
Feb 24, 2024
rajsite
left a comment
Member
There was a problem hiding this comment.
approved assuming confident builds will be good
jattasNI
approved these changes
Feb 26, 2024
m-akinc
enabled auto-merge (squash)
February 26, 2024 19:10
rajsite
disabled auto-merge
February 26, 2024 21:21
rajsite
reviewed
Feb 26, 2024
rajsite
self-requested a review
February 26, 2024 21:40
rajsite
approved these changes
Feb 26, 2024
This file contains hidden or 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
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.
Pull Request
🤨 Rationale
Fixes: #1442
👩💻 Implementation
The options cited in the issue are:
useGrouping: 'auto'- We previously were setting this totrue, which means "display grouping separators even if the locale prefers otherwise." Instead we want"auto", which is "display grouping separators based on the locale preference." The default for this option is"auto"unlessnotationis"compact". We never setnotationto"compact", so we can just leaveuseGroupingto use the default.signDisplay: 'negative'- Though this option value has been supported in all browsers since 8/23, there does not seem to be a version of Typescript whose definition ofIntl.NumberFormatOptionsallows it. There is an open issue for adding support. As a workaround, I've just added type assertions where necessary.roundingPriority: 'lessPrecision'- Just likesignDisplay: 'negative', theroundingPriorityoption has been supported in browsers since 8/23, but Typescript doesn't have support yet. It is tracked by the same issue linked above, and our type assertion serves as a workaround for this, too. By using this option, we can get rid of the separateleadingZeroFormatterinDefaultUnitFormatand simplify the logic.🧪 Testing
Existing tests pass.
✅ Checklist