tc39 / proposal-intl-duration-format

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

How does the negative sign from negative sub-hour values with digital display appear in the final result? #204

Closed trflynn89 closed 4 weeks ago

trflynn89 commented 2 months ago

For example, looking at the following test262 test: https://github.com/tc39/test262/blob/61e3f5ec4d0c8d87af7d6e9b7eba4a42eb379b4f/test/intl402/DurationFormat/prototype/format/negative-duration-with-leading-zero-style-digital-en.js

It seems that the way FormatNumericUnits is currently written, the negative sign from the -0 seconds value is ultimately dropped.

We first format the hours field, which sets signDisplayed to false:

16. If hoursFormatted is true, then
    a. Append FormatNumericHours(durationFormat, hoursValue, signDisplayed) to numericPartsList.
    b. Set signDisplayed to false.

So then when we enter FormatNumericSeconds, because signDisplayed is false, we apply the signDisplay=never option.

It doesn't seem like there are any steps to propagate the negative sign from the seconds value to the hours value to ensure the negative sign is appended before the formatted hours string.

ben-allen commented 1 month ago

207 is up to fix this. Unless I hear otherwise, I'm treating it as a bugfix rather than a normative change requiring plenary consensus. Sound good?