test(format/date-time): add numeric offset without minutes as invalid#960
Open
vtushar06 wants to merge 1 commit into
Open
test(format/date-time): add numeric offset without minutes as invalid#960vtushar06 wants to merge 1 commit into
vtushar06 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds missing negative coverage for the date-time format by asserting that RFC 3339 numeric UTC offsets must include a minutes component (±HH:MM), and that an hour-only offset like +01 is invalid. This strengthens the test suite’s RFC 3339 conformance checks across supported drafts/versions.
Changes:
- Add a new invalid
date-timetest case for1985-04-12T23:20:50+01(offset missing:mm). - Apply the same test addition consistently across draft3, draft4, draft6, draft7, draft2019-09, draft2020-12, and v1 test sets.
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 invalid date-time case for numeric offset missing minutes. |
| tests/draft7/optional/format/date-time.json | Adds the same invalid offset-missing-minutes coverage for draft7 optional format tests. |
| tests/draft6/optional/format/date-time.json | Adds the same invalid offset-missing-minutes coverage for draft6 optional format tests. |
| tests/draft4/optional/format/date-time.json | Adds the same invalid offset-missing-minutes coverage for draft4 optional format tests. |
| tests/draft3/optional/format/date-time.json | Adds the same invalid offset-missing-minutes coverage for draft3 optional format tests. |
| tests/draft2020-12/optional/format/date-time.json | Adds the same invalid offset-missing-minutes coverage for draft2020-12 optional format tests. |
| tests/draft2019-09/optional/format/date-time.json | Adds the same invalid offset-missing-minutes coverage for draft2019-09 optional format tests. |
💡 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.6 and found the suite has no date-time test for a numeric offset that omits the minutes.
RFC 3339 section 5.6 defines
time-numoffset = ("+" / "-") time-hour ":" time-minute- the colon and the two-digittime-minuteare both required. So+01(hour only, no:mm) is invalid. The suite covers a bad offset minute (+10:60) and a bad offset hour (+24:00), but not a whole missing minutes component.Changes
1985-04-12T23:20:50+01- a numeric offset with no minutes - invalid.Ecosystem Impact
(z|([+-])(\d\d)(?::?(\d\d))?)- the entire(?::?(\d\d))?minute group is optional, so+01matches with the minutes treated as absent. This is the defaultaddFormats(ajv)mode.[+-]\d\d:\d\d.is_rfc3339_datetime: PASSES (rejects it).This is the same regex-branch class as ajv-formats issue #117 (colonless offset
+0130); the missing-minutes form+01is the second, distinct sub-branch of the same optional group.RFC References
time-numoffset): https://www.rfc-editor.org/rfc/rfc3339#section-5.6Reproduction 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