tc39 / test262

Official ECMAScript Conformance Test Suite
Other
2.32k stars 459 forks source link

Bug fix for DurationFormat prototype/format/fractions-of-subsecond-units-en.js #4062

Closed ben-allen closed 4 months ago

ben-allen commented 4 months ago

Uncommented erroneously commented line, added roundingMode: 'trunc' to NumberFormat options when fractional digits are formatted to match behaviour of DurationFormat -- doesn't make a difference with these test values, but could with others

FrankYFTang commented 4 months ago

@ben-allen this particular test is still not according to the spec for lacking other necessary fix

"numeric" is not a valid option value for "milliseconds", "microseconds" and "nanoseconds" based on the listed values in 4th "Values" column in https://tc39.es/proposal-intl-duration-format/#table-durationformat

My implementation will throw RangeError for this test because in step 17-f of 1.2.1 Intl.DurationFormat ( [ locales [ , options ] ] )

f. Let unitOptions be ? GetDurationUnitOptions(unit, options, style, valueList, digitalBase, prevStyle).

when unit is dfOpts = {microseconds: "numeric"}; or dfOpts = {nanoseconds: "numeric"};