Skip to content

Update usage of Intl.NumberFormat options - #1791

Merged
rajsite merged 16 commits into
mainfrom
users/makinc/update-intl-numberformat-options
Feb 26, 2024
Merged

rajsite merged 16 commits into
mainfrom
users/makinc/update-intl-numberformat-options

Conversation

@m-akinc

@m-akinc m-akinc commented Jan 30, 2024 •

Copy link
Copy Markdown
Contributor

Pull Request

🤨 Rationale

Fixes: #1442

👩‍💻 Implementation

The options cited in the issue are:

  • useGrouping: 'auto' - We previously were setting this to true, 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" unless notation is "compact". We never set notation to "compact", so we can just leave useGrouping to 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 of Intl.NumberFormatOptions allows it. There is an open issue for adding support. As a workaround, I've just added type assertions where necessary.
  • roundingPriority: 'lessPrecision' - Just like signDisplay: 'negative', the roundingPriority option 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 separate leadingZeroFormatter in DefaultUnitFormat and simplify the logic.

🧪 Testing

Existing tests pass.

✅ Checklist

  • I have updated the project documentation to reflect my changes or determined no changes are needed.

@m-akinc
m-akinc requested a review from mollykreis January 30, 2024 21:53
@m-akinc

m-akinc commented Jan 30, 2024

Copy link
Copy Markdown
Contributor Author

@mollykreis since you're somewhat familiar with this code, would you mind buddying it?

@m-akinc
m-akinc requested a review from mollykreis January 30, 2024 23:41
@m-akinc
m-akinc marked this pull request as ready for review January 31, 2024 21:06
@m-akinc
m-akinc requested a review from rajsite February 1, 2024 00:06
@m-akinc
m-akinc marked this pull request as draft February 1, 2024 18:23
@m-akinc
m-akinc marked this pull request as ready for review February 23, 2024 18:51
@m-akinc
m-akinc requested a review from jattasNI February 23, 2024 18:51
@m-akinc
m-akinc requested a review from rajsite February 24, 2024 00:56

@rajsite rajsite left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved assuming confident builds will be good

@m-akinc
m-akinc enabled auto-merge (squash) February 26, 2024 19:10
@rajsite
rajsite disabled auto-merge February 26, 2024 21:21
@rajsite
rajsite self-requested a review February 26, 2024 21:40
@rajsite
rajsite merged commit d74f49e into main Feb 26, 2024
@rajsite
rajsite deleted the users/makinc/update-intl-numberformat-options branch February 26, 2024 22:08
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

Successfully merging this pull request may close these issues.

Leverage appropriate number format options in number-text table column once supported in all browsers

4 participants