Skip to content

Stricter time format constraints #481

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

Merged
merged 4 commits into from
Apr 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions tests/draft2019-09/optional/format/time.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,84 @@
"tests": [
{
"description": "a valid time string",
"data": "08:30:06Z",
"valid": true
},
{
"description": "a valid time string with leap second",
"data": "23:59:60Z",
"valid": true
},
{
"description": "a valid time string with leap second with offset",
"data": "15:59:60-08:00",
"valid": true
},
{
"description": "a valid time string with second fraction",
"data": "23:20:50.52Z",
"valid": true
},
{
"description": "a valid time string with precise second fraction",
"data": "08:30:06.283185Z",
"valid": true
},
{
"description": "a valid time string with plus offset",
"data": "08:30:06+00:20",
"valid": true
},
{
"description": "a valid time string with minus offset",
"data": "08:30:06-08:00",
"valid": true
},
{
"description": "a valid time string with case-insensitive Z",
"data": "08:30:06z",
"valid": true
},
{
"description": "an invalid time string with invalid hour",
"data": "24:00:00Z",
"valid": false
},
{
"description": "an invalid time string with invalid minute",
"data": "00:60:00Z",
"valid": false
},
{
"description": "an invalid time string with invalid second",
"data": "00:00:61Z",
"valid": false
},
{
"description": "an invalid time string with invalid leap second (wrong hour)",
"data": "22:59:60Z",
"valid": false
},
{
"description": "an invalid time string with invalid leap second (wrong minute)",
"data": "23:58:60Z",
"valid": false
},
{
"description": "an invalid time string with invalid time numoffset hour",
"data": "01:02:03+24:00",
"valid": false
},
{
"description": "an invalid time string with invalid time numoffset minute",
"data": "01:02:03+00:60",
"valid": false
},
{
"description": "an invalid time string with invalid time with both Z and numoffset",
"data": "01:02:03Z+00:30",
"valid": false
},
{
"description": "an invalid time string",
"data": "08:30:06 PST",
Expand Down
75 changes: 75 additions & 0 deletions tests/draft2020-12/optional/format/time.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,84 @@
"tests": [
{
"description": "a valid time string",
"data": "08:30:06Z",
"valid": true
},
{
"description": "a valid time string with leap second",
"data": "23:59:60Z",
"valid": true
},
{
"description": "a valid time string with leap second with offset",
"data": "15:59:60-08:00",
"valid": true
},
{
"description": "a valid time string with second fraction",
"data": "23:20:50.52Z",
"valid": true
},
{
"description": "a valid time string with precise second fraction",
"data": "08:30:06.283185Z",
"valid": true
},
{
"description": "a valid time string with plus offset",
"data": "08:30:06+00:20",
"valid": true
},
{
"description": "a valid time string with minus offset",
"data": "08:30:06-08:00",
"valid": true
},
{
"description": "a valid time string with case-insensitive Z",
"data": "08:30:06z",
"valid": true
},
{
"description": "an invalid time string with invalid hour",
"data": "24:00:00Z",
"valid": false
},
{
"description": "an invalid time string with invalid minute",
"data": "00:60:00Z",
"valid": false
},
{
"description": "an invalid time string with invalid second",
"data": "00:00:61Z",
"valid": false
},
{
"description": "an invalid time string with invalid leap second (wrong hour)",
"data": "22:59:60Z",
"valid": false
},
{
"description": "an invalid time string with invalid leap second (wrong minute)",
"data": "23:58:60Z",
"valid": false
},
{
"description": "an invalid time string with invalid time numoffset hour",
"data": "01:02:03+24:00",
"valid": false
},
{
"description": "an invalid time string with invalid time numoffset minute",
"data": "01:02:03+00:60",
"valid": false
},
{
"description": "an invalid time string with invalid time with both Z and numoffset",
"data": "01:02:03Z+00:30",
"valid": false
},
{
"description": "an invalid time string",
"data": "08:30:06 PST",
Expand Down
75 changes: 75 additions & 0 deletions tests/draft7/optional/format/time.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,84 @@
"tests": [
{
"description": "a valid time string",
"data": "08:30:06Z",
"valid": true
},
{
"description": "a valid time string with leap second",
"data": "23:59:60Z",
"valid": true
},
{
"description": "a valid time string with leap second with offset",
"data": "15:59:60-08:00",
"valid": true
},
{
"description": "a valid time string with second fraction",
"data": "23:20:50.52Z",
"valid": true
},
{
"description": "a valid time string with precise second fraction",
"data": "08:30:06.283185Z",
"valid": true
},
{
"description": "a valid time string with plus offset",
"data": "08:30:06+00:20",
"valid": true
},
{
"description": "a valid time string with minus offset",
"data": "08:30:06-08:00",
"valid": true
},
{
"description": "a valid time string with case-insensitive Z",
"data": "08:30:06z",
"valid": true
},
{
"description": "an invalid time string with invalid hour",
"data": "24:00:00Z",
"valid": false
},
{
"description": "an invalid time string with invalid minute",
"data": "00:60:00Z",
"valid": false
},
{
"description": "an invalid time string with invalid second",
"data": "00:00:61Z",
"valid": false
},
{
"description": "an invalid time string with invalid leap second (wrong hour)",
"data": "22:59:60Z",
"valid": false
},
{
"description": "an invalid time string with invalid leap second (wrong minute)",
"data": "23:58:60Z",
"valid": false
},
{
"description": "an invalid time string with invalid time numoffset hour",
"data": "01:02:03+24:00",
"valid": false
},
{
"description": "an invalid time string with invalid time numoffset minute",
"data": "01:02:03+00:60",
"valid": false
},
{
"description": "an invalid time string with invalid time with both Z and numoffset",
"data": "01:02:03Z+00:30",
"valid": false
},
{
"description": "an invalid time string",
"data": "08:30:06 PST",
Expand Down