-
Notifications
You must be signed in to change notification settings - Fork 171
Fix polyfill: Throw RangeError when a timestring has fractional minutes #3236
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
Open
ioannad
wants to merge
1
commit into
tc39:main
Choose a base branch
from
ioannad:fix-polyfill-fractional-minutes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
4c9cee1 to
0aba840
Compare
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.
0aba840 to
f02895b
Compare
Author
|
Updated to fix formatting errors. |
ioannad
added a commit
to ioannad/test262
that referenced
this pull request
Jan 7, 2026
…s a RangeError. Time strings such as "05:07.123" (fractional minutes) and "12.5" (fractional hours) should throw a RangeError. This addresses proposal-temporal issue: tc39/proposal-temporal#3210 The tests pass in the polyfill with the fix in proposal-temporal PR: tc39/proposal-temporal#3236
Author
|
Tests for this are in test262 PR: tc39/test262#4814 |
Ms2ger
pushed a commit
to ioannad/test262
that referenced
this pull request
Jan 8, 2026
…s a RangeError. Time strings such as "05:07.123" (fractional minutes) and "12.5" (fractional hours) should throw a RangeError. This addresses proposal-temporal issue: tc39/proposal-temporal#3210 The tests pass in the polyfill with the fix in proposal-temporal PR: tc39/proposal-temporal#3236
Ms2ger
pushed a commit
to tc39/test262
that referenced
this pull request
Jan 8, 2026
…s a RangeError. Time strings such as "05:07.123" (fractional minutes) and "12.5" (fractional hours) should throw a RangeError. This addresses proposal-temporal issue: tc39/proposal-temporal#3210 The tests pass in the polyfill with the fix in proposal-temporal PR: tc39/proposal-temporal#3236
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
undefinedminutes 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.