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

PartitionDurationFormatPattern: Unnecessary check for [[MillisecondsStyle]] #152

Closed
anba opened this issue Jun 7, 2023 · 0 comments · Fixed by #159
Closed

PartitionDurationFormatPattern: Unnecessary check for [[MillisecondsStyle]] #152

anba opened this issue Jun 7, 2023 · 0 comments · Fixed by #159

Comments

@anba
Copy link
Contributor

anba commented Jun 7, 2023

PartitionDurationFormatPattern, steps 4.l.9.b.i-iii.:

i. Let nextValue be duration.[[Seconds]].
ii. Let nextDisplay be durationFormat.[[SecondsDisplay]].
iii. If durationFormat.[[MillisecondsStyle]] is "numeric", then
  i. Set nextValue to nextValue + duration.[[Milliseconds]] / 103 + duration.[[Microseconds]] / 106 + duration.[[Nanoseconds]] / 109.

Can be simplified to:

i. Let nextValue be duration.[[Seconds]] + duration.[[Milliseconds]] / 103 + duration.[[Microseconds]] / 106 + duration.[[Nanoseconds]] / 109.
ii. Let nextDisplay be durationFormat.[[SecondsDisplay]].

Because durationFormat.[[MillisecondsStyle]] is "numeric" is always true in this branch.

ryzokuken added a commit to ryzokuken/proposal-intl-duration-format that referenced this issue Jun 30, 2023
Simplify PartitionDurationFormatPattern to get rid of unnecessary
conditional checks.

Fixes: tc39#152
ryzokuken added a commit that referenced this issue Jul 4, 2023
Simplify PartitionDurationFormatPattern to get rid of unnecessary
conditional checks.

Fixes: #152
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant