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

Normative: Fix off-by-one in BalanceISODate for leap year inputs #1926

Merged

Conversation

linusg
Copy link
Member

@linusg linusg commented Nov 16, 2021

Instead of setting testYear to year + 1, and therefore discarding the previous distinction of leap years vs. regular years, just increment it by one.
This matches the polyfill's implementation and yields expected results for all inputs.

Closes #1923.

Instead of setting `testYear` to `year + 1`, and therefore discarding
the previous distinction of leap years vs. regular years, just increment
it by one.
This matches the polyfill's implementation and yields expected results
for all inputs.

Closes tc39#1923.
@codecov
Copy link

codecov bot commented Nov 16, 2021

Codecov Report

Merging #1926 (7e15ed1) into main (2b255c0) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1926   +/-   ##
=======================================
  Coverage   94.92%   94.92%           
=======================================
  Files          19       19           
  Lines       10991    10991           
  Branches     1721     1721           
=======================================
  Hits        10433    10433           
  Misses        543      543           
  Partials       15       15           
Flag Coverage Δ
test262 81.74% <ø> (ø)
tests 89.74% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2b255c0...7e15ed1. Read the comment docs.

@justingrant justingrant marked this pull request as draft November 18, 2021 19:04
@ptomato ptomato added the spec-text Specification text involved label Nov 19, 2021
Copy link
Collaborator

@ptomato ptomato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, this is a bug. I will present it in December at TC39.

It seems to be covered by only one test262 test, but there are many more tests in the legacy test suite that cover it, which we will continue to port over, so I'm not worried about test coverage in the long term.

@ptomato ptomato added the needs plenary input Needs to be presented to the committee and feedback incorporated label Nov 30, 2021
@ptomato
Copy link
Collaborator

ptomato commented Dec 17, 2021

This achieved consensus at the December 2021 TC39 meeting.

@ptomato ptomato marked this pull request as ready for review December 17, 2021 18:35
@ptomato ptomato merged commit 5ab1822 into tc39:main Dec 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs plenary input Needs to be presented to the committee and feedback incorporated spec-text Specification text involved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BalanceISODate returns off-by-one results when adding to a leap year
2 participants