tc39 / proposal-intl-duration-format

https://tc39.es/proposal-intl-duration-format
MIT License
165 stars 18 forks source link

Default fractional digits no longer displayed after #113 #149

Closed anba closed 1 year ago

anba commented 1 year ago

I've missed this in the review for #113, but the changes from #113 actually also changed the format output. For example:

new Intl.DurationFormat("en", {seconds: "numeric"}).format({seconds: 1, milliseconds: 3})

Returned "1.003" before #113, but is now returning "1".

It was returning "1.003", because when fractionalDigits = undefined was passed to the Intl.NumberFormat, the default minimum and maximum fractional digits from Intl.NumberFormat were applied. (mnfdDefault = 0 and mxfdDefault = 3 in InitializeNumberFormat.)

144 may resolve this issue anyway, but I still thought it's worthwhile to file an issue about it.

ryzokuken commented 1 year ago

@anba you're exactly right, this would be resolved by #144 and it's great to keep this in mind when discussing that.