fix(isISO8601): validate end-of-day times consistently - #2879
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2879 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 114 114
Lines 2599 2599
Branches 658 658
=========================================
Hits 2599 2599 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
nrps9909
left a comment
There was a problem hiding this comment.
Validated exact head 7254549ca296f5605eb226a7b7f816ac2086c9fa against a79ff980ab14257e795332989e497bdff3218e87.
The PR tests on unchanged base reproduce 10 failures (7 passing); full head npm test passes 335 tests, including builds and ESLint on Node 24.15.0. All 13 exposed upstream checks pass.
An independent corpus runs 78,908 observations on each of source, Node, browser, and minified browser:
- 57,692 hour-24 observations enumerate minute/second values 00–59 with basic, extended, and mixed separators, plus selected reduced-precision/fraction cases, across all four strict-option combinations.
- 480 additional separator/timezone controls.
- 20,736 ordinary-time compatibility observations use unchanged base behavior as the oracle.
Base has 616 mismatches per form; head has zero, including zero ordinary-time changes in this corpus. This validates the scoped end-of-day behavior and compatibility controls, not exhaustive calendar/timezone or ISO conformance. Keeping hour 24 separate resolves the reported mixed-separator and nonzero-component acceptance paths.
Fixes #2858.
isISO8601('2009-01-01T24:00:00')currently returnsfalse, while mixed separators such asT24:0000and nonzero end-of-day components such asT240030andT24:00.0001are accepted. The24:?00alternative bypasses the separator capture used by the seconds backreference.Handle hour 24 in a separate alternative in both separator modes. This accepts basic and extended end-of-day representations, preserves reduced precision and zero fractions, and requires all lower-order components to be zero. The ordinary-time branch is guarded against falling back to interpreting
24as a seconds-only value. Calendar validation and timezone syntax are unchanged.Regression cases cover valid and invalid end-of-day inputs under all four combinations of
strictandstrictSeparator, including whitespace separation. No generated distribution files are included.Validation
npm test -- --grep 'ISO 8601'— 7 passing, 10 failing; failures reproduce the rejected midnight and accepted mixed-separator inputs.npm test— 335 passing, including all distribution builds and ESLint.git diff --check— passed.References
T24:00.1andT24:00:00.1, which remain accepted by that earlier patch, and covers all four strict-option combinations.Checklist
AI assistance: implemented, tested, and independently reviewed with Codex.