Skip to content

[6.x] Collapse equal range endpoints in NumberFormatter#14657

Merged
jasonvarga merged 5 commits into
6.xfrom
swift-labrador
May 13, 2026
Merged

[6.x] Collapse equal range endpoints in NumberFormatter#14657
jasonvarga merged 5 commits into
6.xfrom
swift-labrador

Conversation

@jasonvarga
Copy link
Copy Markdown
Member

@jasonvarga jasonvarga commented May 12, 2026

NumberFormatter.formatRange() (and the underlying Intl.NumberFormat.formatRange()) prefixes the output with an "approximately" sign (~) whenever the start and end values format to the same string — including when they are strictly equal.

This updates NumberFormatter so that when the range endpoints are strictly equal, it falls back to a regular format() call and returns a single number with no ~ prefix. When the endpoints differ but happen to round to the same display value, the ~ is preserved (since that's the case it's meant to signal).

Resolves the paginator UI specifically: a listing with one item now reads 1 of 1 instead of ~1 of 1. Any other range usage in the CP gets the same treatment for free.

@jasonvarga jasonvarga changed the title [6.x] Show single number for one-item pagination range [6.x] Collapse equal range endpoints in NumberFormatter May 13, 2026
@jasonvarga jasonvarga merged commit 4190a15 into 6.x May 13, 2026
18 checks passed
@jasonvarga jasonvarga deleted the swift-labrador branch May 13, 2026 14:39
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.

1 participant