Closed FrankYFTang closed 5 months ago
The test it will fail
https://github.com/tc39/test262/blob/main/test/intl402/DurationFormat/prototype/format/fractions-of-subsecond-units-en.js
@anba @sffc @ben-allen @ryzokuken
I think it will always hit one of the several
1. Set displayDefault to "auto".
Also, "fractional"
is spec-internal. It can't be specified in the API. It is always "numeric"
in the API.
Also,
"fractional"
is spec-internal. It can't be specified in the API. It is always"numeric"
in the API.
Or not: https://github.com/tc39/proposal-intl-duration-format/issues/196
And in the current spec, all of the following will throw RangeError
let a1 = new Intl.DurationFormat("en", {"milliseconds":"numeric"});
let a2 = new Intl.DurationFormat("en", {"microseconds":"numeric"});
let a3 = new Intl.DurationFormat("en", {"nanoseconds":"numeric"});
let a4 = new Intl.DurationFormat("en", {"milliseconds":"fractional"});
let a5 = new Intl.DurationFormat("en", {"microseconds":"fractional"});
let a6 = new Intl.DurationFormat("en", {"nanoseconds":"fractional"});
a1- a3 will throw RangeError because valuesList for GetDurationUnitOptions are « "long", "short", "narrow", "fractional" » for the case of "milliseconds", "microseconds" and "nanoseconds" and that does not contains "numeric" so GetOption will throw RangeError a4-a6 will throw because Step 7 mentioned above
The following, according to the current spec, will throw RangeError
Is that desireable? The constructor will call f. Let unitOptions be ? GetDurationUnitOptions(unit, options, style, valueList, digitalBase, prevStyle).
with
then inside GetDurationUnitOptions after
style is "fractional" and
then after
display is "always" because displayDefault is "always"
and then
will throw.
But is this desired?