Skip to content

test(format/date-time): add numeric offset without minutes as invalid#960

Open
vtushar06 wants to merge 1 commit into
json-schema-org:mainfrom
vtushar06:datetime-offset-no-minutes
Open

test(format/date-time): add numeric offset without minutes as invalid#960
vtushar06 wants to merge 1 commit into
json-schema-org:mainfrom
vtushar06:datetime-offset-no-minutes

Conversation

@vtushar06

Copy link
Copy Markdown
Contributor

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-digit time-minute are 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

  • Added 1 test case across draft3, draft4, draft6, draft7, draft2019-09, draft2020-12, and v1.
  • 1985-04-12T23:20:50+01 - a numeric offset with no minutes - invalid.

Ecosystem Impact

  1. ajv-formats 3.0.1 (full and fast): FAILS (accepts it). The offset in ajv's TIME regex is (z|([+-])(\d\d)(?::?(\d\d))?) - the entire (?::?(\d\d))? minute group is optional, so +01 matches with the minutes treated as absent. This is the default addFormats(ajv) mode.
  2. python-jsonschema 4.25.1: PASSES (rejects it) - rfc3339-validator requires [+-]\d\d:\d\d.
  3. sourcemeta/core is_rfc3339_datetime: PASSES (rejects it).
  4. Corroboration: jsonschema-rs 0.45.0, boon 0.6.1, santhosh-tekuri/jsonschema v6.0.2, and @hyperjump/json-schema 1.17.6 all reject it - ajv-formats is the outlier.

This is the same regex-branch class as ajv-formats issue #117 (colonless offset +0130); the missing-minutes form +01 is the second, distinct sub-branch of the same optional group.

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

@vtushar06 vtushar06 requested a review from a team as a code owner July 1, 2026 13:47
Copilot AI review requested due to automatic review settings July 1, 2026 13:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-time test case for 1985-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 jviotti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and spec valid as far as I can tell!

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.

3 participants