Skip to content

Conversation

@ptomato
Copy link
Collaborator

@ptomato ptomato commented Nov 19, 2025

Found these in preparation for tc39/proposal-intl-era-monthcode#90 - two cases where the reference code does not implement the spec correctly.

Also updates test262 to pull in the most recent tests (including coverage for these fixes.)

The spec mandates that the shape of the fields property bag must be
checked (and a TypeError thrown if incorrect) before any RangeError
conditions are checked.

See #3166
As per #2940 this belongs
in NonISOResolveFields, before any RangeError conditions are checked.
I have gotten confused by the lack of resolveLunisolarMonth here several
times, so add a comment explaining that it's intentional.
@ptomato ptomato requested a review from gibson042 November 19, 2025 00:43
@codecov
Copy link

codecov bot commented Nov 19, 2025

Codecov Report

❌ Patch coverage is 72.72727% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.66%. Comparing base (17e12be) to head (24dc457).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
polyfill/lib/calendar.mjs 72.72% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3188      +/-   ##
==========================================
+ Coverage   96.49%   96.66%   +0.17%     
==========================================
  Files          22       22              
  Lines       10305    10321      +16     
  Branches     1846     1857      +11     
==========================================
+ Hits         9944     9977      +33     
+ Misses        311      294      -17     
  Partials       50       50              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This fixes a bug where adding 1 year 0 months would skip applying the
overflow option. Brings the polyfill calendar code in line with the
spec text of proposal-intl-era-monthcode.

(For example, in 2020-02-29[u-ca=gregory] + P1Y with overflow: "reject")
@ptomato
Copy link
Collaborator Author

ptomato commented Nov 19, 2025

Tacked on another bug fix to make the polyfill correctly implement NonISODateAdd.

@ptomato ptomato requested a review from Ms2ger November 19, 2025 02:24
@Ms2ger Ms2ger merged commit 8a51e7e into main Nov 19, 2025
10 checks passed
@Ms2ger Ms2ger deleted the polyfill-fixes branch November 19, 2025 10:21
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.

3 participants