Repository navigation
feat(isISO8601Duration): validate ISO 8601 durations - #2956
Open
Aschenbath wants to merge 1 commit into
Open
Aschenbath wants to merge 1 commit into
Aschenbath wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2956 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 114 115 +1
Lines 2599 2624 +25
Branches 658 667 +9
=========================================
+ Hits 2599 2624 +25 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
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.
Add
isISO8601Duration(str)so applications can validate media lengths and other ISO durations without supplying their own regular expression. The existing date-onlyisISO8601behavior is unchanged.Supports ordered year/month/day/time designators, standalone weeks, and alternative calendar/ordinal representations in basic or extended form, including date-only/time-only forms and reduced time precision. Fractions use a dot or comma and are restricted to the last represented unit. Alternative field limits follow ISO 8601:2004 section 4.4.3.3; ordinal days use the explicitly documented range
000through366without leap-year checks. Signed durations, mixed weeks, expanded years and intervals are outside this API's documented scope.Closes #2379.
References: ISO 8601:2004, sections 4.4.3.2 through 4.4.3.3 and their referenced date/time formats (4.1.2, 4.1.3, 4.2.2.2 through 4.2.2.5, 4.3.2 through 4.3.3). The alternative representation describes quantities rather than calendar dates, permits zero fields, and uses inclusive carry-over limits.
Validation:
npm testpasses all 333 tests, including every distribution build and ESLint. The 10 new groups fail on the exact base because the API is absent. Packed CommonJS, direct-module, browser, minified-browser and native ES-module consumption pass all 263 fixture inputs; Node 8 also passes the CommonJS/browser checks. Independent review passed 12,667 generated/boundary cases across four distributions (50,668 assertions). The direct new module also passes on Node 0.10; loading the complete package on that version encounters an existingSetdependency, reproduced on the exact base.Implemented with OpenAI Codex and independently reviewed and tested by a separate Codex agent. No human code review is claimed.
Checklist