Skip to content

Improve number formatting#1008

Merged
hjiangsu merged 1 commit intothunder-app:developfrom
micahmo:feature/number-formatting
Jan 3, 2024
Merged

Improve number formatting#1008
hjiangsu merged 1 commit intothunder-app:developfrom
micahmo:feature/number-formatting

Conversation

@micahmo
Copy link
Copy Markdown
Member

@micahmo micahmo commented Dec 26, 2023

Pull Request Description

This PR introduces a couple of changes related to number formatting.

I updated formatNumberToK to use the intl package's NumberFormat.compact() format rather than formatting it ourselves. There wasn't anything wrong with our code, but this is cleaner! It does make some small improvements like dropping trailing zeros (49.0K -> 49K).

I also updated search results a bit. We previously displayed the full subscriber count unformatted, which was a bit hard to read (like 45827). We could pare it down using ToK, but since we have plenty of room to display the full number, I used decimalPatternDigits instead. It would format the previous number as 45,827 (which I find much easier to read!). And since this is coming from intl, it will be locale-specific (e.g., . instead of ,).

Issue Being Fixed

Issue Number: N/A

Screenshots / Recordings

image

Checklist

  • Did you update CHANGELOG.md?
  • Did you use localized strings where applicable?
  • Did you add semanticLabels where applicable for accessibility?

Copy link
Copy Markdown
Member

@hjiangsu hjiangsu left a comment

Choose a reason for hiding this comment

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

LGTM!

@hjiangsu hjiangsu merged commit c7a5557 into thunder-app:develop Jan 3, 2024
@micahmo micahmo deleted the feature/number-formatting branch January 3, 2024 19:44
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.

2 participants