Skip to content

Commit b454c8c

Browse files
anbaryzokuken
authored andcommitted
Only append time separator when the next value will be displayed
1 parent f4ecb46 commit b454c8c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

spec.emu

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,17 @@ contributors: Ujjwal Sharma, Younies Mahmoud
295295
1. Let _num_ be ! FormatNumeric(_nf_, 𝔽(_value_)).
296296
1. Append the new Record { [[Type]]: _unit_, [[Value]]: _num_} to the end of _result_.
297297
1. If _unit_ is `"hours"` or `"minutes"`, then
298-
1. Let _separator_ be _dataLocaleData_.[[formats]].[[digital]].[[separator]].
299-
1. Append the new Record { [[Type]]: `"literal"`, [[Value]]: _separator_} to the end of _result_.
298+
1. If _unit_ is `"hours"`, then
299+
1. Let _nextValue_ be _duration_.[[Minutes]].
300+
1. Let _nextDisplay_ be _durationFormat_.[[MinutesDisplay]].
301+
1. Else,
302+
1. Let _nextValue_ be _duration_.[[Seconds]].
303+
1. Let _nextDisplay_ be _durationFormat_.[[SecondsDisplay]].
304+
1. If _durationFormat_.[[MillisecondsStyle]] is `"numeric"`, then
305+
1. Set _nextValue_ to _nextValue_ + _duration_.[[Milliseconds]] / 10<sup>3</sup> + _duration_.[[Microseconds]] / 10<sup>6</sup> + _duration_.[[Nanoseconds]] / 10<sup>9</sup>.
306+
1. If _nextValue_ is not 0 or _nextDisplay_ is not `"auto"`, then
307+
1. Let _separator_ be _dataLocaleData_.[[formats]].[[digital]].[[separator]].
308+
1. Append the new Record { [[Type]]: `"literal"`, [[Value]]: _separator_} to the end of _result_.
300309
1. Else,
301310
1. Let _num_ be ! PartitionNumberPattern(_nf_, 𝔽(_value_)).
302311
1. Let _pr_ be ! Construct(%PluralRules%, &laquo; _durationFormat_.[[Locale]] &raquo;).

0 commit comments

Comments
 (0)