Skip to content

date-time validation is too lenient #508

@aznan2

Description

@aznan2

Validation of date-time format accepts the value 2022-02-03T11:47:43.123 as valid, even though a time zone offset or Z is required.

From the JSON schema spec, section 7.3.1:

Date and time format names are derived from RFC 3339, section 5.6.
...
date-time:
A string instance is valid against this attribute if it is a valid representation according to the "date-time" production.

And looking at RFC 3339, section 5.6:

full-time = partial-time time-offset

date-time = full-date "T" full-time

The time-offset part is not optional.

To make it backwards compatible, perhaps the lenient validation could be available as an option, though in that case I think the stricter version should be the default behavior.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions