Skip to content

Commit fd80307

Browse files
authored
Merge pull request #642 from santhosh-tekuri/time-2digit
test/format: hour, min, sec must be two digits
2 parents a76ae65 + e4afd23 commit fd80307

File tree

4 files changed

+80
-0
lines changed

4 files changed

+80
-0
lines changed

tests/draft-next/optional/format/time.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,21 @@
4141
"data": "08:30:06Z",
4242
"valid": true
4343
},
44+
{
45+
"description": "invalid time string with extra leading zeros",
46+
"data": "008:030:006Z",
47+
"valid": false
48+
},
49+
{
50+
"description": "invalid time string with no leading zero for single digit",
51+
"data": "8:3:6Z",
52+
"valid": false
53+
},
54+
{
55+
"description": "hour, minute, second must be two digits",
56+
"data": "8:0030:6Z",
57+
"valid": false
58+
},
4459
{
4560
"description": "a valid time string with leap second, Zulu",
4661
"data": "23:59:60Z",
@@ -131,6 +146,11 @@
131146
"data": "08:30:06-08:00",
132147
"valid": true
133148
},
149+
{
150+
"description": "hour, minute in time-offset must be two digits",
151+
"data": "08:30:06-8:000",
152+
"valid": false
153+
},
134154
{
135155
"description": "a valid time string with case-insensitive Z",
136156
"data": "08:30:06z",

tests/draft2019-09/optional/format/time.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,21 @@
4141
"data": "08:30:06Z",
4242
"valid": true
4343
},
44+
{
45+
"description": "invalid time string with extra leading zeros",
46+
"data": "008:030:006Z",
47+
"valid": false
48+
},
49+
{
50+
"description": "invalid time string with no leading zero for single digit",
51+
"data": "8:3:6Z",
52+
"valid": false
53+
},
54+
{
55+
"description": "hour, minute, second must be two digits",
56+
"data": "8:0030:6Z",
57+
"valid": false
58+
},
4459
{
4560
"description": "a valid time string with leap second, Zulu",
4661
"data": "23:59:60Z",
@@ -131,6 +146,11 @@
131146
"data": "08:30:06-08:00",
132147
"valid": true
133148
},
149+
{
150+
"description": "hour, minute in time-offset must be two digits",
151+
"data": "08:30:06-8:000",
152+
"valid": false
153+
},
134154
{
135155
"description": "a valid time string with case-insensitive Z",
136156
"data": "08:30:06z",

tests/draft2020-12/optional/format/time.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,21 @@
4141
"data": "08:30:06Z",
4242
"valid": true
4343
},
44+
{
45+
"description": "invalid time string with extra leading zeros",
46+
"data": "008:030:006Z",
47+
"valid": false
48+
},
49+
{
50+
"description": "invalid time string with no leading zero for single digit",
51+
"data": "8:3:6Z",
52+
"valid": false
53+
},
54+
{
55+
"description": "hour, minute, second must be two digits",
56+
"data": "8:0030:6Z",
57+
"valid": false
58+
},
4459
{
4560
"description": "a valid time string with leap second, Zulu",
4661
"data": "23:59:60Z",
@@ -131,6 +146,11 @@
131146
"data": "08:30:06-08:00",
132147
"valid": true
133148
},
149+
{
150+
"description": "hour, minute in time-offset must be two digits",
151+
"data": "08:30:06-8:000",
152+
"valid": false
153+
},
134154
{
135155
"description": "a valid time string with case-insensitive Z",
136156
"data": "08:30:06z",

tests/draft7/optional/format/time.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,21 @@
3838
"data": "08:30:06Z",
3939
"valid": true
4040
},
41+
{
42+
"description": "invalid time string with extra leading zeros",
43+
"data": "008:030:006Z",
44+
"valid": false
45+
},
46+
{
47+
"description": "invalid time string with no leading zero for single digit",
48+
"data": "8:3:6Z",
49+
"valid": false
50+
},
51+
{
52+
"description": "hour, minute, second must be two digits",
53+
"data": "8:0030:6Z",
54+
"valid": false
55+
},
4156
{
4257
"description": "a valid time string with leap second, Zulu",
4358
"data": "23:59:60Z",
@@ -128,6 +143,11 @@
128143
"data": "08:30:06-08:00",
129144
"valid": true
130145
},
146+
{
147+
"description": "hour, minute in time-offset must be two digits",
148+
"data": "08:30:06-8:000",
149+
"valid": false
150+
},
131151
{
132152
"description": "a valid time string with case-insensitive Z",
133153
"data": "08:30:06z",

0 commit comments

Comments
 (0)