Skip to content

Temporal should not coerce fractionalSecondDigits #4038

Open

Description

@gibson042

(originally posted by @gibson042 in #3966 (comment) on 2026-09-21)

Given that GetTemporalFractionalSecondDigitsOption is already out of sync with ECMA-4021, can we tighten it up to reject non-integer numbers rather than coercing them?

         1. If _digitsValue_ is not a Number, then
           1. If ? ToString(_digitsValue_) is not *"auto"*, throw a *RangeError* exception.
           1. Return ~auto~.
-        1. If _digitsValue_ is not a finite Number, throw a *RangeError* exception.
-        1. Let _digitCount_ be floor(ℝ(_digitsValue_)).
-        1. If _digitCount_ is not in the inclusive interval from 0 to 9, throw a *RangeError* exception.
-        1. Return _digitCount_.
+        1. Return ? SnapToInteger(_digitsValue_, ~reject~, 0, 9)

Temporal is sufficiently new that it seems unlikely for such a normative change of unexpected input to disrupt existing code.

Footnotes

  1. in which e.g. new Intl.DurationFormat("en", { seconds: "numeric", fractionalDigits: 9.1 }).resolvedOptions().fractionalDigits throws but new Intl.DurationFormat("en", { seconds: "numeric", fractionalDigits: 8.9 }).resolvedOptions().fractionalDigits is 8 because DefaultNumberOption checks ℝ(value) against bounds before flooring, cf. https://github.com/tc39/ecma402/issues/691 and https://github.com/tc39/ecma402/pull/908 ↩

Activity

  1. added
    normative changeAffects behavior required to correctly evaluate some ECMAScript source text
    needs consensusThis needs committee consensus before it can be eligible to be merged.
    needs specification textThe proposal should specify ecmarkup changes that can easily merge into tc39/ecma262/spec.html.
    on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs consensusThis needs committee consensus before it can be eligible to be merged.needs specification textThe proposal should specify ecmarkup changes that can easily merge into tc39/ecma262/spec.html.normative changeAffects behavior required to correctly evaluate some ECMAScript source text

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions