@@ -345,6 +345,13 @@ public class DateFormatters {
345
345
.withResolverStyle (ResolverStyle .STRICT )
346
346
);
347
347
348
+ private static final DateTimeFormatter BASIC_YEAR_MONTH_DAY_PRINTER = new DateTimeFormatterBuilder ()
349
+ .appendValue (ChronoField .YEAR , 4 , 10 , SignStyle .NORMAL )
350
+ .appendValue (MONTH_OF_YEAR , 2 , 2 , SignStyle .NOT_NEGATIVE )
351
+ .appendValue (DAY_OF_MONTH , 2 , 2 , SignStyle .NOT_NEGATIVE )
352
+ .toFormatter (Locale .ROOT )
353
+ .withResolverStyle (ResolverStyle .STRICT );
354
+
348
355
private static final DateTimeFormatter BASIC_YEAR_MONTH_DAY_FORMATTER = new DateTimeFormatterBuilder ()
349
356
.appendValue (ChronoField .YEAR , 4 , 4 , SignStyle .NORMAL )
350
357
.appendValue (MONTH_OF_YEAR , 2 , 2 , SignStyle .NOT_NEGATIVE )
@@ -359,7 +366,7 @@ public class DateFormatters {
359
366
.withResolverStyle (ResolverStyle .STRICT );
360
367
361
368
private static final DateTimeFormatter BASIC_DATE_TIME_PRINTER = new DateTimeFormatterBuilder ()
362
- .append (BASIC_YEAR_MONTH_DAY_FORMATTER )
369
+ .append (BASIC_YEAR_MONTH_DAY_PRINTER )
363
370
.append (BASIC_T_TIME_PRINTER )
364
371
.toFormatter (Locale .ROOT )
365
372
.withResolverStyle (ResolverStyle .STRICT );
@@ -381,12 +388,16 @@ public class DateFormatters {
381
388
new DateTimeFormatterBuilder ().append (BASIC_YEAR_MONTH_DAY_FORMATTER ).appendLiteral ("T" ).toFormatter (Locale .ROOT )
382
389
.withResolverStyle (ResolverStyle .STRICT );
383
390
391
+ private static final DateTimeFormatter BASIC_DATE_T_PRINTER =
392
+ new DateTimeFormatterBuilder ().append (BASIC_YEAR_MONTH_DAY_PRINTER ).appendLiteral ("T" ).toFormatter (Locale .ROOT )
393
+ .withResolverStyle (ResolverStyle .STRICT );
394
+
384
395
/*
385
396
* Returns a basic formatter that combines a basic date and time without millis,
386
397
* separated by a 'T' (uuuuMMdd'T'HHmmssZ).
387
398
*/
388
399
private static final DateFormatter BASIC_DATE_TIME_NO_MILLIS = new JavaDateFormatter ("basic_date_time_no_millis" ,
389
- new DateTimeFormatterBuilder ().append (BASIC_DATE_T ).append (BASIC_TIME_NO_MILLIS_BASE )
400
+ new DateTimeFormatterBuilder ().append (BASIC_DATE_T_PRINTER ).append (BASIC_TIME_NO_MILLIS_BASE )
390
401
.appendOffset ("+HH:MM" , "Z" ).toFormatter (Locale .ROOT )
391
402
.withResolverStyle (ResolverStyle .STRICT ),
392
403
new DateTimeFormatterBuilder ().append (BASIC_DATE_T ).append (BASIC_TIME_NO_MILLIS_BASE )
@@ -467,7 +478,7 @@ public class DateFormatters {
467
478
468
479
private static final DateTimeFormatter STRICT_BASIC_WEEK_DATE_PRINTER = new DateTimeFormatterBuilder ()
469
480
.parseStrict ()
470
- .appendValue (IsoFields .WEEK_BASED_YEAR , 4 )
481
+ .appendValue (IsoFields .WEEK_BASED_YEAR , 4 , 10 , SignStyle . NORMAL )
471
482
.appendLiteral ("W" )
472
483
.appendValue (IsoFields .WEEK_OF_WEEK_BASED_YEAR , 2 , 2 , SignStyle .NEVER )
473
484
.appendValue (ChronoField .DAY_OF_WEEK )
@@ -1000,7 +1011,7 @@ public class DateFormatters {
1000
1011
*/
1001
1012
private static final DateFormatter BASIC_DATE = new JavaDateFormatter ("basic_date" ,
1002
1013
new DateTimeFormatterBuilder ()
1003
- .appendValue (ChronoField .YEAR , 4 , 4 , SignStyle .NORMAL )
1014
+ .appendValue (ChronoField .YEAR , 4 , 10 , SignStyle .NORMAL )
1004
1015
.appendValue (MONTH_OF_YEAR , 2 , 2 , SignStyle .NOT_NEGATIVE )
1005
1016
.appendValue (DAY_OF_MONTH , 2 , 2 , SignStyle .NOT_NEGATIVE )
1006
1017
.toFormatter (Locale .ROOT )
0 commit comments