Debian Codegraph @

share/tests/draft7/optional/format/date.json

raw
1 [
2 {
3 "description": "validation of date strings",
4 "schema": { "format": "date" },
5 "tests": [
6 {
7 "description": "all string formats ignore integers",
8 "data": 12,
9 "valid": true
10 },
11 {
12 "description": "all string formats ignore floats",
13 "data": 13.7,
14 "valid": true
15 },
16 {
17 "description": "all string formats ignore objects",
18 "data": {},
19 "valid": true
20 },
21 {
22 "description": "all string formats ignore arrays",
23 "data": [],
24 "valid": true
25 },
26 {
27 "description": "all string formats ignore booleans",
28 "data": false,
29 "valid": true
30 },
31 {
32 "description": "all string formats ignore nulls",
33 "data": null,
34 "valid": true
35 },
36 {
37 "description": "a valid date string",
38 "data": "1963-06-19",
39 "valid": true
40 },
41 {
42 "description": "a valid date string with 31 days in January",
43 "data": "2020-01-31",
44 "valid": true
45 },
46 {
47 "description": "a invalid date string with 32 days in January",
48 "data": "2020-01-32",
49 "valid": false
50 },
51 {
52 "description": "a valid date string with 28 days in February (normal)",
53 "data": "2021-02-28",
54 "valid": true
55 },
56 {
57 "description": "a invalid date string with 30 days in February (leap)",
58 "data": "2020-02-30",
59 "valid": false
60 },
61 {
62 "description": "a valid date string with 31 days in March",
63 "data": "2020-03-31",
64 "valid": true
65 },
66 {
67 "description": "a invalid date string with 32 days in March",
68 "data": "2020-03-32",
69 "valid": false
70 },
71 {
72 "description": "a valid date string with 30 days in April",
73 "data": "2020-04-30",
74 "valid": true
75 },
76 {
77 "description": "a invalid date string with 31 days in April",
78 "data": "2020-04-31",
79 "valid": false
80 },
81 {
82 "description": "a valid date string with 31 days in May",
83 "data": "2020-05-31",
84 "valid": true
85 },
86 {
87 "description": "a invalid date string with 32 days in May",
88 "data": "2020-05-32",
89 "valid": false
90 },
91 {
92 "description": "a valid date string with 30 days in June",
93 "data": "2020-06-30",
94 "valid": true
95 },
96 {
97 "description": "a invalid date string with 31 days in June",
98 "data": "2020-06-31",
99 "valid": false
100 },
101 {
102 "description": "a valid date string with 31 days in July",
103 "data": "2020-07-31",
104 "valid": true
105 },
106 {
107 "description": "a invalid date string with 32 days in July",
108 "data": "2020-07-32",
109 "valid": false
110 },
111 {
112 "description": "a valid date string with 31 days in August",
113 "data": "2020-08-31",
114 "valid": true
115 },
116 {
117 "description": "a invalid date string with 32 days in August",
118 "data": "2020-08-32",
119 "valid": false
120 },
121 {
122 "description": "a valid date string with 30 days in September",
123 "data": "2020-09-30",
124 "valid": true
125 },
126 {
127 "description": "a invalid date string with 31 days in September",
128 "data": "2020-09-31",
129 "valid": false
130 },
131 {
132 "description": "a valid date string with 31 days in October",
133 "data": "2020-10-31",
134 "valid": true
135 },
136 {
137 "description": "a invalid date string with 32 days in October",
138 "data": "2020-10-32",
139 "valid": false
140 },
141 {
142 "description": "a valid date string with 30 days in November",
143 "data": "2020-11-30",
144 "valid": true
145 },
146 {
147 "description": "a invalid date string with 31 days in November",
148 "data": "2020-11-31",
149 "valid": false
150 },
151 {
152 "description": "a valid date string with 31 days in December",
153 "data": "2020-12-31",
154 "valid": true
155 },
156 {
157 "description": "a invalid date string with 32 days in December",
158 "data": "2020-12-32",
159 "valid": false
160 },
161 {
162 "description": "an invalid date string",
163 "data": "06/19/1963",
164 "valid": false
165 },
166 {
167 "description": "only RFC3339 not all of ISO 8601 are valid",
168 "data": "2013-350",
169 "valid": false
170 },
171 {
172 "description": "non-padded month dates are not valid",
173 "data": "1998-1-20",
174 "valid": false
175 },
176 {
177 "description": "non-padded day dates are not valid",
178 "data": "1998-01-1",
179 "valid": false
180 },
181 {
182 "description": "invalid month",
183 "data": "1998-13-01",
184 "valid": false
185 },
186 {
187 "description": "2021 is not a leap year",
188 "data": "2021-02-29",
189 "valid": false
190 },
191 {
192 "description": "2020 is a leap year",
193 "data": "2020-02-29",
194 "valid": true
195 },
196 {
197 "description": "invalid non-ASCII '৪' (a Bengali 4)",
198 "data": "1963-06-1৪",
199 "valid": false
200 },
201 {
202 "description": "invalid: non-ASCII Bengali digit in month field",
203 "data": "2020-0৪-01",
204 "valid": false
205 },
206 {
207 "description": "ISO8601 / non-RFC3339: YYYYMMDD without dashes (2023-03-28)",
208 "data": "20230328",
209 "valid": false
210 },
211 {
212 "description": "ISO8601 / non-RFC3339: week number implicit day of week (2023-01-02)",
213 "data": "2023-W01",
214 "valid": false
215 },
216 {
217 "description": "ISO8601 / non-RFC3339: week number with day of week (2023-03-28)",
218 "data": "2023-W13-2",
219 "valid": false
220 },
221 {
222 "description": "ISO8601 / non-RFC3339: week number rollover to next year (2023-01-01)",
223 "data": "2022W527",
224 "valid": false
225 },
226 {
227 "description": "an invalid time string in date-time format",
228 "data": "2020-11-28T23:55:45Z",
229 "valid": false
230 },
231 {
232 "description": "century year 0100 is not a leap year",
233 "comment": "https://www.rfc-editor.org/rfc/rfc3339#appendix-C — 100 % 100 == 0 but 100 % 400 != 0",
234 "data": "0100-02-29",
235 "valid": false
236 },
237 {
238 "description": "century year 0400 is a leap year",
239 "comment": "https://www.rfc-editor.org/rfc/rfc3339#appendix-C — 400-year cycle boundary",
240 "data": "0400-02-29",
241 "valid": true
242 },
243 {
244 "description": "century year 2100 is not a leap year",
245 "comment": "https://www.rfc-editor.org/rfc/rfc3339#appendix-C — future century year",
246 "data": "2100-02-29",
247 "valid": false
248 },
249 {
250 "description": "invalid: leading whitespace is not permitted",
251 "comment": "https://www.rfc-editor.org/rfc/rfc3339#section-5.6 — full-date grammar does not include whitespace",
252 "data": " 2024-01-15",
253 "valid": false
254 },
255 {
256 "description": "invalid: trailing whitespace is not permitted",
257 "comment": "https://www.rfc-editor.org/rfc/rfc3339#section-5.6 — full-date grammar does not include whitespace",
258 "data": "2024-01-15 ",
259 "valid": false
260 },
261 {
262 "description": "invalid: month 00 is not valid per date-month range 01-12",
263 "comment": "https://www.rfc-editor.org/rfc/rfc3339#section-5.6 — date-month = 2DIGIT ; 01-12",
264 "data": "2024-00-15",
265 "valid": false
266 },
267 {
268 "description": "invalid: day 00 is not valid per date-mday minimum of 01",
269 "comment": "https://www.rfc-editor.org/rfc/rfc3339#section-5.6 — date-mday = 2DIGIT ; 01-28/29/30/31",
270 "data": "2024-01-00",
271 "valid": false
272 },
273 {
274 "description": "invalid: empty string",
275 "data": "",
276 "valid": false
277 },
278 {
279 "description": "invalid: embedded whitespace between year and month",
280 "data": "2020 -01-01",
281 "valid": false
282 },
283 {
284 "description": "invalid: trailing character after valid full-date",
285 "data": "2020-01-01X",
286 "valid": false
287 },
288 {
289 "description": "invalid: trailing Z after full-date",
290 "data": "2020-01-01Z",
291 "valid": false
292 },
293 {
294 "description": "invalid: full-date followed by space and time component",
295 "data": "2020-01-01 00:00:00Z",
296 "valid": false
297 },
298 {
299 "description": "valid: four-digit year 0001",
300 "data": "0001-01-01",
301 "valid": true
302 },
303 {
304 "description": "invalid: two-digit year (N-2 digits)",
305 "data": "20-01-01",
306 "valid": false
307 },
308 {
309 "description": "invalid: three-digit year (N-1 digits)",
310 "data": "998-01-01",
311 "valid": false
312 },
313 {
314 "description": "invalid: five-digit year (N+1 digits)",
315 "data": "12020-01-01",
316 "valid": false
317 },
318 {
319 "description": "invalid: positive sign prefix on year",
320 "data": "+2020-01-01",
321 "valid": false
322 },
323 {
324 "description": "invalid: negative sign prefix on year",
325 "data": "-2020-01-01",
326 "valid": false
327 },
328 {
329 "description": "invalid: non-ASCII Bengali digit in year field",
330 "data": "২020-01-01",
331 "valid": false
332 },
333 {
334 "description": "invalid: alphabetic characters in year field",
335 "data": "YYYY-01-01",
336 "valid": false
337 },
338 {
339 "description": "invalid: three-digit month (N+1 digits)",
340 "data": "2020-001-01",
341 "valid": false
342 },
343 {
344 "description": "invalid: alphabetic characters in month field",
345 "data": "2020-MM-01",
346 "valid": false
347 },
348 {
349 "description": "invalid: three-digit day (N+1 digits)",
350 "data": "2020-01-001",
351 "valid": false
352 },
353 {
354 "description": "invalid: alphabetic characters in day field",
355 "data": "2020-01-DD",
356 "valid": false
357 },
358 {
359 "description": "invalid: colon separators",
360 "data": "2020:01:01",
361 "valid": false
362 },
363 {
364 "description": "invalid: dot separators",
365 "data": "2020.01.01",
366 "valid": false
367 },
368 {
369 "description": "invalid: space separators",
370 "data": "2020 01 01",
371 "valid": false
372 },
373 {
374 "description": "invalid: mixed slash and hyphen separators",
375 "data": "2020-01/01",
376 "valid": false
377 },
378 {
379 "description": "invalid: duplicated first hyphen",
380 "data": "2020--01-01",
381 "valid": false
382 },
383 {
384 "description": "invalid: duplicated second hyphen",
385 "data": "2020-01--01",
386 "valid": false
387 },
388 {
389 "description": "valid: date inside the Julian to Gregorian reform gap",
390 "data": "1582-10-10",
391 "valid": true
392 },
393 {
394 "description": "invalid: year field numerically larger than a 32-bit signed integer",
395 "data": "2147483648-01-01",
396 "valid": false
397 },
398 {
399 "description": "invalid: character just above '9' as the second digit of the day",
400 "data": "2020-01-0:",
401 "valid": false
402 },
403 {
404 "description": "invalid: non-ASCII digit leaving ten UTF-8 bytes but eight characters",
405 "data": "\u09e80-01-01",
406 "valid": false
407 },
408 {
409 "description": "invalid: en dash separators instead of hyphen-minus",
410 "data": "2020\u201301\u201301",
411 "valid": false
412 },
413 {
414 "description": "invalid: NUL character after an otherwise valid full-date",
415 "data": "2020-01-01\u0000",
416 "valid": false
417 }
418 ]
419 }
420 ]