Automattic / Automattic/jetpack

Number Formatting: add new function to format a number to a short format

Open
#24,554 0 comments 0 reactions 0 assignees View on GitHub
[Focus] i18n [JS Package] Components [Pri] Normal Enhancement RNA
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

We currently have a very simple number format function available in the components package here:
https://github.com/Automattic/jetpack/tree/d20049ade86703517f345f973fe9d6d9bc6c8baa/projects/js-packages/components/components/number-format

It would be nice if we had an additional utility to use a short format, for bigger numbers for example.

Here is how it's done in Calypso:
https://github.com/Automattic/wp-calypso/blob/9fb7ac149e55361c0c3a9639ad0caa5e15fc88b0/client/lib/format-number-compact/index.js

*******

Related issues:
- Deprecate i18n-calypso's `numberFormat`: https://github.com/Automattic/i18n-issues/issues/923
- Introduce `numberFormat` in Core: https://github.com/WordPress/gutenberg/issues/22628

*******

Reference: https://github.com/Automattic/jetpack/pull/24544/files#r883993113

Contributor guide

Open the contributing guide

Research direction

Read projects/js-packages/components/components/number-format and compare the existing formatter with Calypso's client/lib/format-number-compact/index.js. The work is complete when the components package provides the requested short-format utility for larger numbers, with behavior aligned to the referenced implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.