Skip to content

Add sequence units to explainer - #141

Open
eemeli wants to merge 1 commit into
mainfrom
sequencing
Open

Add sequence units to explainer#141
eemeli wants to merge 1 commit into
mainfrom
sequencing

Conversation

@eemeli

@eemeli eemeli commented Aug 8, 2026

Copy link
Copy Markdown
Member

This adds what I understand to be our current consensus on how to support sequence units (see e.g. #118 and proposal-intl-sequence-units), i.e. using an array as the .value where appropriate.

The spec is not (yet) updated by this change, just the explainer.

Going through the details, there are a few cases that I'm not sure we've covered previously, and on some of which this PR is opinionated:

  • Combining significantDigits with sequence units — I recommend we throw an error for this, as the general solution here would effectively require dealing with non-decimal bases.
  • Type of not-smallest unit values when applying fractionDigits — Are all array values stringified? For example, with
    let a = new Amount([5, 11.1], { fractionDigits: 0 })
    a.value  //  [5, '1.1e+1']  or  ['5e+0', '1.1e+1']
    both options seem somewhat reasonable to me.
  • The non-localized serialization of not-smallest unit values — we require these to always be integers, so shouldn't we also serialize them as plain integers? Without significantDigits, these can't have precision information attached to them.
  • As with the -per- units mentioned in #140, conversion to/from -and- units requires multiple sequential Number operations that can introduce deviations compared to decimal math.

Ping @sffc, @gibson042, @ljharb

@eemeli
eemeli requested a review from jessealama August 8, 2026 08:35
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://tc39.github.io/proposal-amount/pr-preview/pr-141/

Built to branch gh-pages at 2026-08-08 08:35 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@jessealama jessealama left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks! I agree that trying to specify significant digits when working with sequence units should throw, at least for now. I think it's worth discussing some of your other opinionated bits in new issues.

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