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

Editorial: Various changes encountered while working on Duration math #2609

Merged
merged 5 commits into from
Jun 21, 2023

Conversation

ptomato
Copy link
Collaborator

@ptomato ptomato commented Jun 16, 2023

Here's another PR with various editorial improvements that I came across while working on the integer math in Durations. More explanations in the individual commit messages.

Using _largestUnit_ here was unintentional and doesn't match the argument
types of RoundDuration.
…fill

While investigating integer math, this discrepancy has been unhelpful. If
I had to choose one of the two ways of implementing it, I'd choose this
one anyway, because it's more concise and deals with the quantity that is
actually returned to the user.
This needs some changes in callers because of a bug in Ecmarkup (see
tc39/ecmarkup#529), but I think the change is
probably for the better anyway.
toString() can only round the seconds and lower units, so we do not need
to pass all the units in to RoundDuration - we can only round to seconds
increments and smaller anyway. This makes it clearer that implementations
can treat seconds as a single number if they wish.
@codecov
Copy link

codecov bot commented Jun 16, 2023

Codecov Report

Merging #2609 (c484783) into main (08d214e) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #2609      +/-   ##
==========================================
- Coverage   95.98%   95.98%   -0.01%     
==========================================
  Files          20       20              
  Lines       11573    11572       -1     
  Branches     2198     2198              
==========================================
- Hits        11108    11107       -1     
  Misses        401      401              
  Partials       64       64              
Impacted Files Coverage Δ
polyfill/lib/duration.mjs 94.71% <100.00%> (-0.01%) ⬇️

@Ms2ger Ms2ger merged commit 3bf0cfe into main Jun 21, 2023
@Ms2ger Ms2ger deleted the editorial branch June 21, 2023 13:21
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Sep 13, 2023
…udet

Implement the `Duration.prototype.total` changes from <tc39/proposal-temporal#2609>.

No change in behaviour, because our implementation already matched the updated
spec. Only changed variables names to `total` to match the new spec and removed
comments about adding `quotient + remainder`, which no longer apply because the
addition operation was removed from the spec.

Differential Revision: https://phabricator.services.mozilla.com/D185405
vinnydiehl pushed a commit to vinnydiehl/mozilla-unified that referenced this pull request Sep 14, 2023
…udet

Implement the `Duration.prototype.total` changes from <tc39/proposal-temporal#2609>.

No change in behaviour, because our implementation already matched the updated
spec. Only changed variables names to `total` to match the new spec and removed
comments about adding `quotient + remainder`, which no longer apply because the
addition operation was removed from the spec.

Differential Revision: https://phabricator.services.mozilla.com/D185405
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 this pull request may close these issues.

2 participants