test(format/date-time): add hour 24 on the leap-second path as invalid#961
Open
vtushar06 wants to merge 1 commit into
Open
test(format/date-time): add hour 24 on the leap-second path as invalid#961vtushar06 wants to merge 1 commit into
vtushar06 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR strengthens the JSON Schema Test Suite’s format: "date-time" coverage by adding a regression test that ensures implementations reject hour 24 even when parsing a leap-second timestamp with an offset that could normalize to a valid UTC leap instant.
Changes:
- Added a new invalid
date-timecase:2016-12-31T24:59:60+01:00(hour 24 on a leap-second path). - Applied the same test across draft3, draft4, draft6, draft7, draft2019-09, draft2020-12, and v1.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/v1/format/date-time.json | Adds the new invalid hour-24 + leap-second test for v1 date-time format coverage. |
| tests/draft7/optional/format/date-time.json | Adds the new invalid hour-24 + leap-second test for draft7 optional date-time format. |
| tests/draft6/optional/format/date-time.json | Adds the new invalid hour-24 + leap-second test for draft6 optional date-time format. |
| tests/draft4/optional/format/date-time.json | Adds the new invalid hour-24 + leap-second test for draft4 optional date-time format. |
| tests/draft3/optional/format/date-time.json | Adds the new invalid hour-24 + leap-second test for draft3 optional date-time format. |
| tests/draft2020-12/optional/format/date-time.json | Adds the new invalid hour-24 + leap-second test for draft2020-12 optional date-time format. |
| tests/draft2019-09/optional/format/date-time.json | Adds the new invalid hour-24 + leap-second test for draft2019-09 optional date-time format. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jviotti
approved these changes
Jul 1, 2026
jviotti
left a comment
Member
There was a problem hiding this comment.
Looks good and spec valid as far as I can tell!
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.
Following the methodology I used for ipv4 and uuid, I read RFC 3339 section 5.7 and found the suite tests hour 24 only on the ordinary path, not on the leap-second path.
RFC 3339 section 5.7 says "this profile of ISO 8601 only allows values between 00 and 23 for the hour". The suite has
1990-12-31T24:00:00Z(hour 24, ordinary path) and it is correctly rejected. But2016-12-31T24:59:60+01:00combines hour 24 with a leap second: the offset shifts it to UTC 23:59:60, which is a valid leap instant, so a validator that checks the hour bound only on the non-leap path lets the 24 through.Changes
2016-12-31T24:59:60+01:00- hour 24 on a leap-second timestamp - invalid.Ecosystem Impact
hr <= 23 && min <= 59only on thesec < 60path; thesec == 60leap branch verifies the offset-adjusted UTC time is 23:59 but never re-checks the raw hour, so24:59:60+01:00(UTC 23:59:60) passes with hour 24. This is the defaultaddFormats(ajv)mode; ajv-fast rejects it.is_rfc3339_datetime: PASSES (rejects it - it range-checks the hour before the leap logic).RFC References
Reproduction and the date-time cross-implementation matrix are in my evidence repo: https://github.com/vtushar06/JSON-Schema-format-test-Evidence/blob/main/date-time.md
Related: #965