Skip to content

Conversation

@ioannad
Copy link

@ioannad ioannad commented Jan 2, 2026

This addresses issue #3210

The regex parser falls into a corner case for strings with separators that have fractional minutes and no seconds. It ends up parsing undefined minutes and interprets the fraction as seconds.

Instead of complicating the regex parser, change ParseISODateTime and ParseTemporalTimeString to throw a RangeError if there a fraction is defined, and either: seconds are undefined (safety measure, the regex parser actually takes care of this) or: minutes are undefined and hours are defined.

This takes care of the corner case without complicating the regex parser, for readability.

This addresses issue tc39#3210

The regex parser falls into a corner case for strings with separators that
have fractional minutes and no seconds. It ends up parsing `undefined` minutes
and interprets the fraction as seconds.

Instead of complicating the regex parser, change ParseISODateTime and
ParseTemporalTimeString to throw a RangeError if there a fraction is defined, and
either: seconds are undefined (safety measure, the regex parser actually takes care of this)
or: minutes are undefined and hours are defined.

This takes care of the corner case without complicating the regex parser, for readability.
@codecov
Copy link

codecov bot commented Jan 2, 2026

Codecov Report

❌ Patch coverage is 69.23077% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.72%. Comparing base (28e9e69) to head (4c9cee1).

Files with missing lines Patch % Lines
polyfill/lib/ecmascript.mjs 69.23% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3236      +/-   ##
==========================================
- Coverage   96.75%   96.72%   -0.04%     
==========================================
  Files          22       22              
  Lines       10398    10411      +13     
  Branches     1859     1863       +4     
==========================================
+ Hits        10061    10070       +9     
- Misses        289      291       +2     
- Partials       48       50       +2     

☔ 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.

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.

1 participant