Skip to content
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 inconsistent number formatting between mobile and web #6384

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

khuddite
Copy link
Contributor

Fixes: #6364

  1. Summary
    It seems roundingMode: 'trunc' is not supported in the mobile runtime. Thus, the flag is simply ignored and falls back to default behavior, which seems to be a roundup

  2. Solution
    Replaced roundingMode with a manual truncation logic

  3. Screenshots
    CleanShot 2024-11-15 at 13 45 19
    image

@gaearon
Copy link
Contributor

gaearon commented Nov 15, 2024

We need to consider Japanese and a few other locales that don't use 3/6/9/12 as the breaking points.

@gaearon
Copy link
Contributor

gaearon commented Nov 15, 2024

Here's what ChatGPT told me:

Where Factor of 10^3 Doesn’t Work
Here’s a summary of locales where the standard K (10^3) and M (10^6) approach doesn’t apply directly:

  • East Asia (Japan, China, Korea): Uses 10^4 (万) and 10^8 (亿, 億, 억).
  • India: Uses 10^5 (lakh) and 10^7 (crore).
  • Older European Long Scale Countries: Countries using milliard for billion (though less common today).

I think it would be good to get a large list of locales, loop over them, and then format 9, 99, 999, 9999, and so on, using our hacky polyfilled version. Then find where it doesn't look correct (i.e. where it causes 0 to show up) and fix those.

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.

Unify rounding up/down number of followers between app and web versions
2 participants