summaryrefslogtreecommitdiffstats
path: root/intl/icu/source/test/testdata/format.txt
blob: c6121a1c57d363c95960b3d48fb3aee28f6ce1f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
// Copyright (c) 2007-2015 International Business Machines
// Corporation and others. All Rights Reserved.
format:table(nofallback) {
    Info {
        Description { "These are the data driven format tests" }
        LongDescription {   "Data for data driven format tests." }
    }
    TestData {
        TestDateFormatBasic {
            Info {
                Description { "Test data for format and parse :" }
            }
            Settings {
                // options: 'format', or 'parse'.  One can be omitted if this is a 1 way test.
                {
                    Type { "date_format" }
                },
                {
                    Type { "date_parse" }
                },
            }
            Headers { "locale", "zone", "spec", "date", "str"}
            // locale: locale including calendar type
            // zone:   time zone name, or "" to not explicitly set zone
            // spec:   either 'PATTERN=y mm h' etc, or 'DATE=SHORT,TIME=LONG'
            // date:   either 'MILLIS=####' where #### is millis,
            //        or a calendar spec ERA=0,YEAR=1, etc.. applied to the calendar type specified by the locale
            //        or RELATIVE_MILLIS=### where ### is a signed value which is added to the current millis
            //        or RELATIVE_ADD:DATE=1  which means that the field "DATE" will be added by +1 relative to current time,
            //           and any other fields present will be set explicitly.
            // str:   the expected unicode string
            Cases { 
               {
                    "en_US@calendar=gregorian",
                    "",
                    "DATE=SHORT,TIME=SHORT",
                    "ERA=1,YEAR=2007,MONTH=AUGUST,DATE=8,HOUR_OF_DAY=18,MINUTE=54,SECOND=0",
                    "8/8/07, 6:54 PM"
               },
               {
                    "zh_TW@calendar=roc",
                    "",
                    "DATE=LONG",
                    "ERA=1,YEAR=98,MONTH=0,DATE=24",
                    "民國98年1月24日",
               },
               {
                    //民國前2年1月24日 -> 1910-1-24 
                    "zh_TW@calendar=roc",
                    "",
                    "DATE=LONG",
                    "ERA=0,YEAR=2,MONTH=0,DATE=24",
                    "民國前2年1月24日",
               },
            }
        }
        TestFormatRelative {
            Info {
                Description { "relative format :" }
            }
            Settings {
                {
                    Type { "date_format" }
                },
            }
            Headers { "locale", "zone", "spec", "date", "str"}
            Cases { 
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "DATE=RELATIVE_SHORT",
                    "RELATIVE_ADD:DATE=1", // one day from now
                    "tomorrow"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "DATE=RELATIVE_SHORT",
                    "RELATIVE_MILLIS=0", // today
                    "today"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "DATE=RELATIVE_SHORT",
                    "RELATIVE_ADD:DATE=-1", // one day before now
                    "yesterday"
               },
               // date only, out of relative range
               {
                    "en_US@calendar=gregorian",         
                    "GMT",
                    "DATE=RELATIVE_FULL",
                    "ERA=1,YEAR=2012,MONTH=OCTOBER,DATE=8,HOUR_OF_DAY=23,MINUTE=59,SECOND=0",
                    "Monday, October 8, 2012"
               },
               // time only
               {
                    "en_US@calendar=gregorian",         
                    "GMT",
                    "TIME=LONG",
                    "ERA=1,YEAR=2012,MONTH=OCTOBER,DATE=8,HOUR_OF_DAY=23,MINUTE=59,SECOND=0",
                    "11:59:00 PM GMT"
               },
               {
                    "en_US@calendar=gregorian",         
                    "GMT",
                    "TIME=LONG",
                    "RELATIVE_ADD:DATE=-1,HOUR_OF_DAY=17,MINUTE=0,SECOND=0", // one day before now at specified time
                    "5:00:00 PM GMT"
               },
               // normal formats, combined using 'at'
               {
                    "en_US@calendar=gregorian",         
                    "GMT",
                    "DATE=RELATIVE_FULL,TIME=LONG",
                    "ERA=1,YEAR=2012,MONTH=OCTOBER,DATE=8,HOUR_OF_DAY=23,MINUTE=59,SECOND=0",
                    "Monday, October 8, 2012, 11:59:00 PM GMT"
               },
               // normal formats, combined using ", "
               {
                    "en_US@calendar=gregorian",         
                    "GMT",
                    "DATE=RELATIVE_MEDIUM,TIME=SHORT",
                    "ERA=1,YEAR=2012,MONTH=OCTOBER,DATE=8,HOUR_OF_DAY=23,MINUTE=59,SECOND=0",
                    "Oct 8, 2012, 11:59 PM"
               },
               // formats with relative day, combined using 'at'
               {
                    "en_US@calendar=gregorian",         
                    "GMT",
                    "DATE=RELATIVE_FULL,TIME=LONG",
                    "RELATIVE_ADD:DATE=-1,HOUR_OF_DAY=17,MINUTE=0,SECOND=0", // one day before now at specified time
                    "yesterday, 5:00:00 PM GMT"
               },
               // formats with relative day, combined using ", "
               {
                    "en_US@calendar=gregorian",         
                    "GMT",
                    "DATE=RELATIVE_MEDIUM,TIME=SHORT",
                    "RELATIVE_ADD:DATE=-1,HOUR_OF_DAY=17,MINUTE=0,SECOND=0", // one day before now at specified time
                    "yesterday, 5:00 PM"
               },
               // normal formats that have quoted literals, combined
               {
                    "pt@calendar=gregorian",         
                    "GMT",
                    "DATE=RELATIVE_FULL,TIME=LONG",
                    "ERA=1,YEAR=2012,MONTH=OCTOBER,DATE=8,HOUR_OF_DAY=23,MINUTE=59,SECOND=0",
                    "segunda-feira, 8 de outubro de 2012 23:59:00 GMT"
               },
               // vi combined formats have time first
               {
                    "vi@calendar=gregorian",         
                    "GMT",
                    "DATE=RELATIVE_LONG,TIME=MEDIUM",
                    "ERA=1,YEAR=2012,MONTH=OCTOBER,DATE=8,HOUR_OF_DAY=23,MINUTE=59,SECOND=0",
                    "23:59:00 8 tháng 10, 2012"
               },
               {
                    "vi@calendar=gregorian",         
                    "GMT",
                    "DATE=RELATIVE_LONG,TIME=MEDIUM",
                    "RELATIVE_ADD:DATE=-1,HOUR_OF_DAY=17,MINUTE=0,SECOND=0", // one day before now at specified time
                    "17:00:00 Hôm qua"
               },
               // el combines formats using hyphen
               {
                    "el@calendar=gregorian",         
                    "GMT",
                    "DATE=RELATIVE_LONG,TIME=MEDIUM",
                    "ERA=1,YEAR=2012,MONTH=OCTOBER,DATE=8,HOUR_OF_DAY=23,MINUTE=59,SECOND=0",
                    "8 Οκτωβρίου 2012 - 11:59:00 μ.μ."
               },
               {
                    "el@calendar=gregorian",         
                    "GMT",
                    "DATE=RELATIVE_LONG,TIME=MEDIUM",
                    "RELATIVE_ADD:DATE=-1,HOUR_OF_DAY=17,MINUTE=0,SECOND=0", // one day before now at specified time
                    "χθες - 5:00:00 μ.μ."
               },
              // other tests
               {
                    "mt_MT@calendar=gregorian",         
                    "",
                    "DATE=RELATIVE_SHORT",
                    "RELATIVE_ADD:DATE=1", // one day from now
                    "għada"
               },
               {
                    "mt_MT@calendar=gregorian",         
                    "",
                    "DATE=RELATIVE_SHORT",
                    "RELATIVE_MILLIS=0", // today
                    "illum"
               },
               {
                    "mt_MT@calendar=gregorian",         
                    "",
                    "DATE=RELATIVE_SHORT",
                    "RELATIVE_ADD:DATE=-1", // one day before now
                    "lbieraħ"
               },
               {
                    "ru",
                    "",
                    "DATE=RELATIVE_SHORT",
                    "RELATIVE_ADD:DATE=-2", // 2 days ago
                    "позавчера"
               },
            }
        }
        TestYearLengths {
            Info {
                Description { "Test data for multiple year lengths, y yy yyy yyyy yyyyy:" }
            }
            Settings {
                // options: 'format', or 'parse'.  One can be omitted if this is a 1 way test.
                {
                    Type { "date_format" }
                },
// These are not round trippable, so do not parse.
//                {
//                    Type { "date_parse" }
//                },
            }
            Headers { "locale", "zone", "spec", "date", "str"}
            // locale: locale including calendar type
            // zone:   time zone name, or "" to not explicitly set zone
            // spec:   either 'PATTERN=y mm h' etc, or 'DATE=SHORT,TIME=LONG'
            // date:   either 'MILLIS=####' where #### is millis,
            //        or a calendar spec ERA=0,YEAR=1, etc.. applied to the calendar type specified by the locale
            //        or RELATIVE_MILLIS=### where ### is a signed value which is added to the current millis
            //        or RELATIVE_ADD:DATE=1  which means that the field "DATE" will be added by +1 relative to current time,
            //           and any other fields present will be set explicitly.
            // str:   the expected unicode string
           
// from CLDR UTS 35: 
//Year  	y  	yy  	yyy  	yyyy  	yyyyy
            
            Cases { 
//AD 1 	    1 	01 	001 	0001 	00001
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G y",
                    "YEAR=1",
                    "AD 1"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yy",
                    "YEAR=1",
                    "AD 01"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yyy",
                    "YEAR=1",
                    "AD 001"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yyyy",
                    "YEAR=1",
                    "AD 0001"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yyyyy",
                    "YEAR=1",
                    "AD 00001"
               },
//AD 12 	12 	12 	012 	0012 	00012
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G y",
                    "YEAR=12",
                    "AD 12"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yy",
                    "YEAR=12",
                    "AD 12"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yyy",
                    "YEAR=12",
                    "AD 012"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yyyy",
                    "YEAR=12",
                    "AD 0012"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yyyyy",
                    "YEAR=12",
                    "AD 00012"
               },
//AD 123 	123 	23 	123 	0123 	00123
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G y",
                    "YEAR=123",
                    "AD 123"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yy",
                    "YEAR=123",
                    "AD 23"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yyy",
                    "YEAR=123",
                    "AD 123"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yyyy",
                    "YEAR=123",
                    "AD 0123"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yyyyy",
                    "YEAR=123",
                    "AD 00123"
               },
//AD 1234 	1234 	34 	1234 	1234 	01234
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G y",
                    "YEAR=1234",
                    "AD 1234"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yy",
                    "YEAR=1234",
                    "AD 34"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yyy",
                    "YEAR=1234",
                    "AD 1234"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yyyy",
                    "YEAR=1234",
                    "AD 1234"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yyyyy",
                    "YEAR=1234",
                    "AD 01234"
               },
//AD 12345 	12345 	45 	12345 	12345 	12345
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G y",
                    "YEAR=12345",
                    "AD 12345"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yy",
                    "YEAR=12345",
                    "AD 45"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yyy",
                    "YEAR=12345",
                    "AD 12345"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yyyy",
                    "YEAR=12345",
                    "AD 12345"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yyyyy",
                    "YEAR=12345",
                    "AD 12345"
               },
            }
        }
        TestConsistentPivot {
            Info {
                Description { "Test consistent pivot (parse/format) for multiple year lengths, y yy yyy yyyy yyyyy:" }
            }
            Settings {
                // options: 'format', or 'parse'.  One can be omitted if this is a 1 way test.
                {
                    Type { "date_format" }
                },
                {
                    Type { "date_parse" }
                },
            }
            Headers { "locale", "zone", "spec", "date", "str"}
            // locale: locale including calendar type
            // zone:   time zone name, or "" to not explicitly set zone
            // spec:   either 'PATTERN=y mm h' etc, or 'DATE=SHORT,TIME=LONG'
            // date:   either 'MILLIS=####' where #### is millis,
            //        or a calendar spec ERA=0,YEAR=1, etc.. applied to the calendar type specified by the locale
            //        or RELATIVE_MILLIS=### where ### is a signed value which is added to the current millis
            //        or RELATIVE_ADD:DATE=1  which means that the field "DATE" will be added by +1 relative to current time,
            //           and any other fields present will be set explicitly.
            // str:   the expected unicode string
           
// from CLDR UTS 35: 
//Year  	y  	yy  	yyy  	yyyy  	yyyyy
            
            Cases { 
//AD 1 	    1 	01 	001 	0001 	00001
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G y",
                    "YEAR=2008",
                    "AD 2008"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yy",
                    "YEAR=2008",
                    "AD 08"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yyy",
                    "YEAR=2008",
                    "AD 2008"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yyyy",
                    "YEAR=2008",
                    "AD 2008"
               },
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=G yyyyy",
                    "YEAR=2008",
                    "AD 02008"
               },

				// Japanese
//               {
//                    "en_US@calendar=japanese",         
//                    "",
//                    "PATTERN=G y",
//                    "YEAR=8",
//                    "Heisei 8"
//               },
//               {
//                    "en_US@calendar=japanese",         
//                    "",
//                    "PATTERN=G yy",
//                    "YEAR=8",
//                    "Heisei 08"
//               },
//               {
//                    "en_US@calendar=japanese",         
//                    "",
//                    "PATTERN=G yyy",
//                    "YEAR=8",
//                    "Heisei 008"
//               },
//               {
//                    "en_US@calendar=japanese",         
//                    "",
//                    "PATTERN=G yyyy",
//                    "YEAR=8",
//                    "Heisei 0008"
//               },
//               {
//                    "en_US@calendar=japanese",         
//                    "",
//                    "PATTERN=G yyyyy",
//                    "YEAR=8",
//                    "Heisei 00008"
//               },

            }
        }
        TestHebrew{
            Info {
                Description { "Test Hebrew calendar:" }
            }
            Settings {
                // options: 'format', or 'parse'.  One can be omitted if this is a 1 way test.
                {
                    Type { "date_format" }
                },
            }
            Headers { "locale", "zone", "spec", "date", "str"}
            // locale: locale including calendar type
            // zone:   time zone name, or "" to not explicitly set zone
            // spec:   either 'PATTERN=y mm h' etc, or 'DATE=SHORT,TIME=LONG'
            // date:   either 'MILLIS=####' where #### is millis,
            //        or a calendar spec ERA=0,YEAR=1, etc.. applied to the calendar type specified by the locale
            //        or RELATIVE_MILLIS=### where ### is a signed value which is added to the current millis
            //        or RELATIVE_ADD:DATE=1  which means that the field "DATE" will be added by +1 relative to current time,
            //           and any other fields present will be set explicitly.
            // str:   the expected unicode string
            
            Cases { 
               {
                    "en_US@calendar=hebrew",         
                    "",
                    "DATE=FULL,TIME=FULL",
                    "MILLIS=3076424179200000",
                    "Friday, 3 Heshvan 103217 at 12:00:00 AM GMT-08:00"
               },
            }    
        }
        TestMoreDateParse {
            Info {
                Description { "Additional date parse tests (may not
               round/trip to format.)" }
            }
            Settings {
                // options: 'format', or 'parse'.  One can be omitted if this is a 1 way test.
                {
                    Type { "date_parse" }
                },
            }
            Headers { "locale", "zone", "spec", "date", "str"}
            // locale: locale including calendar type
            // zone:   time zone name, or "" to not explicitly set zone
            // spec:   either 'PATTERN=y mm h' etc, or 'DATE=SHORT,TIME=LONG'
            // date:   either 'MILLIS=####' where #### is millis,
            //        or a calendar spec ERA=0,YEAR=1, etc.. applied to the calendar type specified by the locale
            //        or RELATIVE_MILLIS=### where ### is a signed value which is added to the current millis
            //        or RELATIVE_ADD:DATE=1  which means that the field "DATE" will be added by +1 relative to current time,
            //           and any other fields present will be set explicitly.
            // str:   the expected unicode string
            
            Cases { 
               {
                    "en_US@calendar=gregorian",         
                    "",
                    "PATTERN=YYYYHHmmssEEEww",
                    "YEAR=1999,HOUR_OF_DAY=4,MINUTE=5,SECOND=6,DAY_OF_WEEK=2,WEEK_OF_YEAR=4",
               // won't roundtrip.
                    "1998040506MON56"
               }
            }    
        }
    }        
}