Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and simplify "displayRequired" computation in PartitionDurationFormatPattern #183

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions spec.emu
Original file line number Diff line number Diff line change
Expand Up @@ -286,18 +286,12 @@ contributors: Ujjwal Sharma, Younies Mahmoud
1. Perform ! CreateDataPropertyOrThrow(_nfOpts_, *"minimumFractionDigits"*, 𝔽(_durationFormat_.[[FractionalDigits]])).
1. Perform ! CreateDataPropertyOrThrow(_nfOpts_, *"roundingMode"*, *"trunc"*).
1. Set _done_ to *true*.
1. Let _displayRequired_ be *"false"*.
1. Let _hoursStyle_ be _durationFormat_.[[HoursStyle]].
1. If _unit_ is *"minutes"*, then
1. If _hoursStyle_ is *"numeric"* or *"2-digit"*, then
1. Let _hoursDisplay_ be _durationFormat_.[[HoursDisplay]].
1. Let _hoursValue_ be _durationFormat_.[[HoursValue]].
1. If _hoursDisplay_ is *"always"* or _hoursValue_ is not 0, then
1. Let _secondsDisplay_ be _durationFormat_.[[SecondsDisplay]].
1. Let _secondsValue_ be _durationFormat_.[[SecondsValue]].
1. If _secondsDisplay_ is *"always"* or _secondsValue_ is not 0, then
1. Set _displayRequired_ to *"true"*.
1. If _value_ is not 0 or _display_ is not *"auto"* or _displayRequired_ is *"true"*, then
1. Let _displayRequired_ be *false*.
1. If _unit_ is *"minutes"* and _needSeparator_ is true, then
1. Let _secondsDisplay_ be _durationFormat_.[[SecondsDisplay]].
1. If _secondsDisplay_ is *"always"*, or _duration_.[[Seconds]] is not 0, or _duration_.[[Milliseconds]] is not 0, or _duration_.[[Microseconds]] is not 0, or _duration_.[[Nanoseconds]] is not 0, then
1. Set _displayRequired_ to *true*.
1. If _value_ is not 0 or _display_ is not *"auto"* or _displayRequired_ is *true*, then
1. If _displayNegativeSign_ is *true*, then
1. Set _displayNegativeSign_ to *false*.
1. Else,
Expand All @@ -322,8 +316,6 @@ contributors: Ujjwal Sharma, Younies Mahmoud
1. If _style_ is *"2-digit"* or *"numeric"*, then
1. Set _needSeparator_ to *true*.
1. Append _list_ to _result_.
1. Else,
1. Set _needSeparator_ to *false*.
1. Let _lfOpts_ be OrdinaryObjectCreate(*null*).
1. Perform ! CreateDataPropertyOrThrow(_lfOpts_, *"type"*, *"unit"*).
1. Let _listStyle_ be _durationFormat_.[[Style]].
Expand Down