Add tests for keep-trailing-zeros proposal#4608
Open
Conversation
4 tasks
gibson042
reviewed
Feb 10, 2026
test/intl402/NumberFormat/prototype/format/value-decimal-string-trailing-zeros.js
Outdated
Show resolved
Hide resolved
test/intl402/NumberFormat/prototype/format/value-decimal-string-trailing-zeros.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
eemeli
added a commit
to tc39/proposal-intl-keep-trailing-zeros
that referenced
this pull request
Feb 18, 2026
gibson042
reviewed
Feb 20, 2026
Member
gibson042
left a comment
There was a problem hiding this comment.
LGTM after filling in pending front matter.
gibson042
reviewed
Feb 27, 2026
| assert.sameValue(nf.format('12.30e-1'), '1.230'); | ||
| assert.sameValue(nf.format('12.30e-2'), '0.1230'); | ||
| assert.sameValue(nf.format('12.30e-3'), '0.01230'); | ||
| assert.sameValue(nf.format('1.2345e-1000'), '0.0000'); |
Member
There was a problem hiding this comment.
tc39/proposal-intl-keep-trailing-zeros#15
Suggested change
| assert.sameValue(nf.format('1.2345e-1000'), '0.0000'); | |
| assert.sameValue(nf.format('1.2345e-1000'), '0.00000000000000000000'); |
(1.2345e-1000 formats exactly as "0.0…0…12345", which maximumFractionDigits rounds to "0.0…0". In the absence of trailing zero preservation it would be further transformed to "0", but that no longer happens here.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposal repo: https://github.com/tc39/proposal-intl-keep-trailing-zeros
The currently proposed spec text won't satisfy all of these tests; I'll be filing a PR incorporating the required changes.
I've created a patched fork of the FormatJS Intl.NumberFormat polyfill to run these tests: https://github.com/eemeli/formatjs-for-keep-trailing-zeros