Skip to content

Commit 440009e

Browse files
authored
CLDR-18370 Make atTime default for DateTimeFormatType per UTS 35 clarification (#4827)
1 parent ab1ae0b commit 440009e

File tree

3 files changed

+24
-39
lines changed

3 files changed

+24
-39
lines changed

common/testData/datetime/README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,15 @@ and various input datetime values.
1111
The test generator constructs the expected value using the various pieces
1212
(date format pattern, time format pattern, datetime "glue" pattern)
1313
and `SimpleDateFormat`s to combine them together.
14-
Each test case reports the inputs for the test case and the expected value.
14+
Each test case reports the inputs for the test case and the expected value.
15+
16+
The UTS 35 LDML spec for datetime formatting will be updated in CLDR v48 to specify
17+
that the default value for dateTimeFormatType will be "atTime".
18+
dateTimeFormatType represents the value that indicates the type of
19+
datetime "glue" pattern, ex: indicating "atTime" or "standard" pattern.
20+
By datetime "glue" pattern, we mean the pattern that is used to combine the result
21+
of date-only formatting and time-only formatting to arrive at the overall combined
22+
formatting for the datetime object containing both a date and a time.
23+
Therefore, for test cases in the dataset in which a date and a time are both present
24+
in the datetime object, if a dateTimeFormatType is not specified explicitly, the
25+
value should be assumed to be "atTime".

common/testData/datetime/datetime.json

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
{
4545
"dateLength": "full",
4646
"timeLength": "short",
47-
"dateTimeFormatType": "atTime",
4847
"calendar": "gregorian",
4948
"locale": "en",
5049
"input": "2000-01-01T00:00Z[Etc/GMT]",
@@ -53,7 +52,6 @@
5352
{
5453
"dateLength": "full",
5554
"timeLength": "short",
56-
"dateTimeFormatType": "atTime",
5755
"calendar": "gregorian",
5856
"locale": "en",
5957
"input": "2024-07-01T08:50:07Z[Etc/GMT]",
@@ -62,7 +60,6 @@
6260
{
6361
"dateLength": "full",
6462
"timeLength": "short",
65-
"dateTimeFormatType": "atTime",
6663
"calendar": "gregorian",
6764
"locale": "en",
6865
"input": "2014-07-15T12:00Z[Etc/GMT]",
@@ -98,7 +95,6 @@
9895
{
9996
"dateLength": "short",
10097
"timeLength": "full",
101-
"dateTimeFormatType": "atTime",
10298
"calendar": "gregorian",
10399
"locale": "en",
104100
"input": "2000-01-01T00:00Z[Etc/GMT]",
@@ -107,7 +103,6 @@
107103
{
108104
"dateLength": "short",
109105
"timeLength": "full",
110-
"dateTimeFormatType": "atTime",
111106
"calendar": "gregorian",
112107
"locale": "en",
113108
"input": "2000-01-01T00:00+10:30[Australia/Adelaide]",
@@ -116,7 +111,6 @@
116111
{
117112
"dateLength": "short",
118113
"timeLength": "full",
119-
"dateTimeFormatType": "atTime",
120114
"calendar": "gregorian",
121115
"locale": "en",
122116
"input": "2024-07-01T08:50:07Z[Etc/GMT]",
@@ -125,7 +119,6 @@
125119
{
126120
"dateLength": "short",
127121
"timeLength": "full",
128-
"dateTimeFormatType": "atTime",
129122
"calendar": "gregorian",
130123
"locale": "en",
131124
"input": "2024-07-01T08:50:07+09:30[Australia/Adelaide]",
@@ -134,7 +127,6 @@
134127
{
135128
"dateLength": "short",
136129
"timeLength": "full",
137-
"dateTimeFormatType": "atTime",
138130
"calendar": "gregorian",
139131
"locale": "en",
140132
"input": "2014-07-15T12:00Z[Etc/GMT]",
@@ -143,7 +135,6 @@
143135
{
144136
"dateLength": "short",
145137
"timeLength": "full",
146-
"dateTimeFormatType": "atTime",
147138
"calendar": "gregorian",
148139
"locale": "en",
149140
"input": "2014-07-15T12:00+09:30[Australia/Adelaide]",
@@ -775,7 +766,6 @@
775766
{
776767
"dateLength": "full",
777768
"timeLength": "short",
778-
"dateTimeFormatType": "atTime",
779769
"calendar": "islamic-civil",
780770
"locale": "ar-SA",
781771
"input": "2000-01-01T00:00Z[Etc/GMT]",
@@ -784,7 +774,6 @@
784774
{
785775
"dateLength": "full",
786776
"timeLength": "short",
787-
"dateTimeFormatType": "atTime",
788777
"calendar": "islamic-civil",
789778
"locale": "ar-SA",
790779
"input": "2024-07-01T08:50:07Z[Etc/GMT]",
@@ -793,7 +782,6 @@
793782
{
794783
"dateLength": "full",
795784
"timeLength": "short",
796-
"dateTimeFormatType": "atTime",
797785
"calendar": "islamic-civil",
798786
"locale": "ar-SA",
799787
"input": "2014-07-15T12:00Z[Etc/GMT]",
@@ -829,7 +817,6 @@
829817
{
830818
"dateLength": "short",
831819
"timeLength": "full",
832-
"dateTimeFormatType": "atTime",
833820
"calendar": "islamic-civil",
834821
"locale": "ar-SA",
835822
"input": "2000-01-01T00:00Z[Etc/GMT]",
@@ -838,7 +825,6 @@
838825
{
839826
"dateLength": "short",
840827
"timeLength": "full",
841-
"dateTimeFormatType": "atTime",
842828
"calendar": "islamic-civil",
843829
"locale": "ar-SA",
844830
"input": "2000-01-01T00:00+10:30[Australia/Adelaide]",
@@ -847,7 +833,6 @@
847833
{
848834
"dateLength": "short",
849835
"timeLength": "full",
850-
"dateTimeFormatType": "atTime",
851836
"calendar": "islamic-civil",
852837
"locale": "ar-SA",
853838
"input": "2024-07-01T08:50:07Z[Etc/GMT]",
@@ -856,7 +841,6 @@
856841
{
857842
"dateLength": "short",
858843
"timeLength": "full",
859-
"dateTimeFormatType": "atTime",
860844
"calendar": "islamic-civil",
861845
"locale": "ar-SA",
862846
"input": "2024-07-01T08:50:07+09:30[Australia/Adelaide]",
@@ -865,7 +849,6 @@
865849
{
866850
"dateLength": "short",
867851
"timeLength": "full",
868-
"dateTimeFormatType": "atTime",
869852
"calendar": "islamic-civil",
870853
"locale": "ar-SA",
871854
"input": "2014-07-15T12:00Z[Etc/GMT]",
@@ -874,7 +857,6 @@
874857
{
875858
"dateLength": "short",
876859
"timeLength": "full",
877-
"dateTimeFormatType": "atTime",
878860
"calendar": "islamic-civil",
879861
"locale": "ar-SA",
880862
"input": "2014-07-15T12:00+09:30[Australia/Adelaide]",
@@ -1506,7 +1488,6 @@
15061488
{
15071489
"dateLength": "full",
15081490
"timeLength": "short",
1509-
"dateTimeFormatType": "atTime",
15101491
"calendar": "buddhist",
15111492
"locale": "th-TH",
15121493
"input": "2000-01-01T00:00Z[Etc/GMT]",
@@ -1515,7 +1496,6 @@
15151496
{
15161497
"dateLength": "full",
15171498
"timeLength": "short",
1518-
"dateTimeFormatType": "atTime",
15191499
"calendar": "buddhist",
15201500
"locale": "th-TH",
15211501
"input": "2024-07-01T08:50:07Z[Etc/GMT]",
@@ -1524,7 +1504,6 @@
15241504
{
15251505
"dateLength": "full",
15261506
"timeLength": "short",
1527-
"dateTimeFormatType": "atTime",
15281507
"calendar": "buddhist",
15291508
"locale": "th-TH",
15301509
"input": "2014-07-15T12:00Z[Etc/GMT]",
@@ -1560,7 +1539,6 @@
15601539
{
15611540
"dateLength": "short",
15621541
"timeLength": "full",
1563-
"dateTimeFormatType": "atTime",
15641542
"calendar": "buddhist",
15651543
"locale": "th-TH",
15661544
"input": "2000-01-01T00:00Z[Etc/GMT]",
@@ -1569,7 +1547,6 @@
15691547
{
15701548
"dateLength": "short",
15711549
"timeLength": "full",
1572-
"dateTimeFormatType": "atTime",
15731550
"calendar": "buddhist",
15741551
"locale": "th-TH",
15751552
"input": "2000-01-01T00:00+10:30[Australia/Adelaide]",
@@ -1578,7 +1555,6 @@
15781555
{
15791556
"dateLength": "short",
15801557
"timeLength": "full",
1581-
"dateTimeFormatType": "atTime",
15821558
"calendar": "buddhist",
15831559
"locale": "th-TH",
15841560
"input": "2024-07-01T08:50:07Z[Etc/GMT]",
@@ -1587,7 +1563,6 @@
15871563
{
15881564
"dateLength": "short",
15891565
"timeLength": "full",
1590-
"dateTimeFormatType": "atTime",
15911566
"calendar": "buddhist",
15921567
"locale": "th-TH",
15931568
"input": "2024-07-01T08:50:07+09:30[Australia/Adelaide]",
@@ -1596,7 +1571,6 @@
15961571
{
15971572
"dateLength": "short",
15981573
"timeLength": "full",
1599-
"dateTimeFormatType": "atTime",
16001574
"calendar": "buddhist",
16011575
"locale": "th-TH",
16021576
"input": "2014-07-15T12:00Z[Etc/GMT]",
@@ -1605,7 +1579,6 @@
16051579
{
16061580
"dateLength": "short",
16071581
"timeLength": "full",
1608-
"dateTimeFormatType": "atTime",
16091582
"calendar": "buddhist",
16101583
"locale": "th-TH",
16111584
"input": "2014-07-15T12:00+09:30[Australia/Adelaide]",
@@ -2237,7 +2210,6 @@
22372210
{
22382211
"dateLength": "full",
22392212
"timeLength": "short",
2240-
"dateTimeFormatType": "atTime",
22412213
"calendar": "japanese",
22422214
"locale": "ja-JP",
22432215
"input": "2000-01-01T00:00Z[Etc/GMT]",
@@ -2246,7 +2218,6 @@
22462218
{
22472219
"dateLength": "full",
22482220
"timeLength": "short",
2249-
"dateTimeFormatType": "atTime",
22502221
"calendar": "japanese",
22512222
"locale": "ja-JP",
22522223
"input": "2024-07-01T08:50:07Z[Etc/GMT]",
@@ -2255,7 +2226,6 @@
22552226
{
22562227
"dateLength": "full",
22572228
"timeLength": "short",
2258-
"dateTimeFormatType": "atTime",
22592229
"calendar": "japanese",
22602230
"locale": "ja-JP",
22612231
"input": "2014-07-15T12:00Z[Etc/GMT]",
@@ -2291,7 +2261,6 @@
22912261
{
22922262
"dateLength": "short",
22932263
"timeLength": "full",
2294-
"dateTimeFormatType": "atTime",
22952264
"calendar": "japanese",
22962265
"locale": "ja-JP",
22972266
"input": "2000-01-01T00:00Z[Etc/GMT]",
@@ -2300,7 +2269,6 @@
23002269
{
23012270
"dateLength": "short",
23022271
"timeLength": "full",
2303-
"dateTimeFormatType": "atTime",
23042272
"calendar": "japanese",
23052273
"locale": "ja-JP",
23062274
"input": "2000-01-01T00:00+10:30[Australia/Adelaide]",
@@ -2309,7 +2277,6 @@
23092277
{
23102278
"dateLength": "short",
23112279
"timeLength": "full",
2312-
"dateTimeFormatType": "atTime",
23132280
"calendar": "japanese",
23142281
"locale": "ja-JP",
23152282
"input": "2024-07-01T08:50:07Z[Etc/GMT]",
@@ -2318,7 +2285,6 @@
23182285
{
23192286
"dateLength": "short",
23202287
"timeLength": "full",
2321-
"dateTimeFormatType": "atTime",
23222288
"calendar": "japanese",
23232289
"locale": "ja-JP",
23242290
"input": "2024-07-01T08:50:07+09:30[Australia/Adelaide]",
@@ -2327,7 +2293,6 @@
23272293
{
23282294
"dateLength": "short",
23292295
"timeLength": "full",
2330-
"dateTimeFormatType": "atTime",
23312296
"calendar": "japanese",
23322297
"locale": "ja-JP",
23332298
"input": "2014-07-15T12:00Z[Etc/GMT]",
@@ -2336,7 +2301,6 @@
23362301
{
23372302
"dateLength": "short",
23382303
"timeLength": "full",
2339-
"dateTimeFormatType": "atTime",
23402304
"calendar": "japanese",
23412305
"locale": "ja-JP",
23422306
"input": "2014-07-15T12:00+09:30[Australia/Adelaide]",

tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateDateTimeTestData.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ public class GenerateDateTimeTestData {
5959

6060
/**
6161
* The known set of values used to indicate the type of "glue pattern" aka the dateTimeFormat
62-
* type.
62+
* type. The default value should be assumed to be AT_TIME if a variable of type
63+
* DateTimeFormatType is not set.
6364
*
6465
* <p>atTime = the word "at" is inserted between the date and time when formatting both date &
6566
* time together, at least for long and full dates.
@@ -353,10 +354,11 @@ private static String getExpectedStringForTestCase(
353354
} else if (timeLength == null) {
354355
formattedDateTime = dateFormatter.format(zdt);
355356
} else {
356-
assert (dateTimeGluePatternFormatType != null);
357357
String formattedDate = dateFormatter.format(zdt);
358358
String formattedTime = timeFormatter.format(zdt);
359359

360+
assert dateTimeGluePatternFormatType != null;
361+
360362
formattedDateTime =
361363
localeCldrFile.glueDateTimeFormat(
362364
formattedDate,
@@ -573,6 +575,12 @@ private static ImmutableSet<FieldStyleComboInput> getFieldStyleComboInputs() {
573575
// - column alignment
574576
// - time precision
575577

578+
// TODO: For semantic skeleton test cases,
579+
// add DateTimeFormatType=STANDARD to test cases
580+
// once CLDR DateTimeFormats constructor can use CLDRFile to get the dateTimeFormat glue
581+
// pattern, since we are currently using ICU to get the dateTimeFormat pattern,
582+
// which defaults to the behavior of DateTimeFormatType.AT_TIME
583+
576584
// 1 (Row 2)
577585
elem = new FieldStyleComboInput();
578586
elem.fieldStyleCombo.timeStyle = TimeStyle.SHORT;
@@ -1249,6 +1257,8 @@ private static TestCaseSerde convertTestCaseToSerialize(TestCase testCase) {
12491257
result.classicalSkeleton = testCase.classicalSkeleton;
12501258
result.dateTimeFormatType =
12511259
Optional.ofNullable(testCase.testCaseInput.fieldStyleCombo.dateTimeFormatType)
1260+
// because AT_TIME is the default, we do not serialize it to the output
1261+
.filter(dtft -> dtft != DateTimeFormatType.AT_TIME)
12521262
.map(DateTimeFormatType::getLabel)
12531263
.orElse(null);
12541264
result.hourCycle =

0 commit comments

Comments
 (0)