Skip to content

test(format): expand date-time suite to 132 exhaustive RFC 3339 cases#891

Open
AcEKaycgR wants to merge 1 commit intojson-schema-org:mainfrom
AcEKaycgR:exhaustive-date-time-suite
Open

test(format): expand date-time suite to 132 exhaustive RFC 3339 cases#891
AcEKaycgR wants to merge 1 commit intojson-schema-org:mainfrom
AcEKaycgR:exhaustive-date-time-suite

Conversation

@AcEKaycgR
Copy link
Copy Markdown
Contributor

Addresses #965. This PR expands the date-time format test suite from 29 to 132 cases across all drafts.The expansion is designed to provide complete coverage of RFC 3339 §5.6 ABNF and §5.7 prose constraints, serving as a standalone compliance target for implementors.

Technical Coverage Details

The new cases cover every structural dimension of the grammar:

  • Separator validation: T absent, space/tab/duplicate instead of T; colons absent/replaced/duplicated in time; hyphens absent/replaced in date.
  • Offset forms: Z-only, numeric offsets (+/-HH:MM), missing offset, offset without colon (+0000), Z followed by numeric offset, offset sign variants (±, ++, +-, -+), non-padded and 3-digit offset fields, and non-ASCII digits.
  • Year boundaries: 3-digit, 5-digit, characters just outside ASCII digit range (/ and :), non-ASCII Bengali digits, negative prefixes, and year 0000 (valid) and 9999 (valid) limits.
  • Month/Day logic: Full Gregorian calendar coverage—including non-century leap (1996), century/400 leap (2000), century non-leap (1900), and year-0000 leap—month-specific maximums (Jan 31/Apr 30/Feb 28), and day 00 rejection.
  • Time & Precision: Floor/ceiling valid values, non-padded fields, and 3-digit hour/minute/second fields; secfrac validation covering 1-digit, 19-digit (arbitrary precision), all-zeros, and non-ASCII mid-frac characters.
  • Leap seconds: Confirmed 2016-12-31 IERS date and offset scenarios that produce incorrect UTC.
  • Whitespace & Composites: Rejection of empty strings, leading/trailing spaces, tab separators, and trailing garbage.

Standards & Traceability

Following the style established in the ipv4.json suite[cite: 41], this PR adds a top-level comment field citing the full RFC 3339 §5.6 ABNF and §5.7 prose rules. Additionally, it corrects one existing description: "an invalid date-time past leap second, UTC" is updated to "second 61 is above the absolute maximum of 60".

Triangulation Results

The suite was validated against the following implementations:

  • Ajv (v8 + ajv-formats): 129 Pass / 3 Mismatch
  • Python jsonschema: 126 Pass / 6 Mismatch
  • validator.js: 118 Pass / 14 Mismatch

These mismatches represent implementation differences from strict RFC 3339 compliance rather than errors in the test vectors.

Feedback on the coverage matrix and test structure is appreciated @jviotti @jdesrosiers

@AcEKaycgR AcEKaycgR requested a review from a team as a code owner April 11, 2026 03:30
@karenetheridge
Copy link
Copy Markdown
Member

Please respect the existing formatting of these tests and avoid making unnecessary whitespace changes.

Comment thread tests/draft2019-09/optional/format/date-time.json Outdated
Comment thread tests/draft2019-09/optional/format/date-time.json Outdated
@AcEKaycgR AcEKaycgR force-pushed the exhaustive-date-time-suite branch from c20e88b to 339a28e Compare April 11, 2026 17:33
@AcEKaycgR
Copy link
Copy Markdown
Contributor Author

AcEKaycgR commented Apr 11, 2026

Thanks for the review, @karenetheridge.

All three points have been addressed in the latest commit:

  • Comment: Trimmed down to a concise prose summary; no more full ABNF quote inline.
  • Year 9999 tests: Removed both the "year 9999 is valid" case and the "maximum boundary" composite that also used 9999, for the same timezone/DST reason.
  • Indentation: Restored to 4 spaces to match the rest of the suite. For future PRs ,I’ll make sure to respect and match the existing file formatting rather than reformatting on write.

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.

2 participants