Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON Schema date-time format no validated correctly #105

Open
dezfowler opened this issue Sep 22, 2017 · 0 comments
Open

JSON Schema date-time format no validated correctly #105

dezfowler opened this issue Sep 22, 2017 · 0 comments

Comments

@dezfowler
Copy link

The JSON Schema spec says the string date-time format should match https://tools.ietf.org/html/rfc3339.

This RFC is actually pretty restrictive - the ABNF in the RFC is...

   date-fullyear   = 4DIGIT
   date-month      = 2DIGIT  ; 01-12
   date-mday       = 2DIGIT  ; 01-28, 01-29, 01-30, 01-31 based on
                             ; month/year
   time-hour       = 2DIGIT  ; 00-23
   time-minute     = 2DIGIT  ; 00-59
   time-second     = 2DIGIT  ; 00-58, 00-59, 00-60 based on leap second
                             ; rules
   time-secfrac    = "." 1*DIGIT
   time-numoffset  = ("+" / "-") time-hour ":" time-minute
   time-offset     = "Z" / time-numoffset

   partial-time    = time-hour ":" time-minute ":" time-second
                     [time-secfrac]
   full-date       = date-fullyear "-" date-month "-" date-mday
   full-time       = partial-time time-offset

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

For a string to match it MUST include a timezone offset i.e. "Z" or "+01:00" however currently a value with no offset information will match e.g. "1977-02-01T00:00:00.000".

This is because the "K" in the custom date time format string used "yyyy-MM-dd\THH:mm:ss.FFFFFFFK" allows the offset to be omitted.

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

No branches or pull requests

1 participant