@@ -89,7 +89,7 @@ public class DateFormatters {
89
89
.appendLiteral ('T' )
90
90
.append (STRICT_HOUR_MINUTE_SECOND_FORMATTER )
91
91
.optionalStart ()
92
- .appendFraction (NANO_OF_SECOND , 3 , 3 , true )
92
+ .appendFraction (NANO_OF_SECOND , 3 , 9 , true )
93
93
.optionalEnd ()
94
94
.optionalStart ()
95
95
.appendZoneOrOffsetId ()
@@ -158,7 +158,7 @@ public class DateFormatters {
158
158
.appendValue (HOUR_OF_DAY , 2 , 2 , SignStyle .NOT_NEGATIVE )
159
159
.appendValue (MINUTE_OF_HOUR , 2 , 2 , SignStyle .NOT_NEGATIVE )
160
160
.appendValue (SECOND_OF_MINUTE , 2 , 2 , SignStyle .NOT_NEGATIVE )
161
- .appendFraction (NANO_OF_SECOND , 1 , 3 , true )
161
+ .appendFraction (NANO_OF_SECOND , 1 , 9 , true )
162
162
.toFormatter (Locale .ROOT );
163
163
164
164
private static final DateTimeFormatter BASIC_TIME_PRINTER = new DateTimeFormatterBuilder ()
@@ -264,7 +264,7 @@ public class DateFormatters {
264
264
private static final DateFormatter BASIC_ORDINAL_DATE_TIME = new JavaDateFormatter ("basic_ordinal_date_time" ,
265
265
new DateTimeFormatterBuilder ().appendPattern ("yyyyDDD" ).append (BASIC_T_TIME_PRINTER )
266
266
.appendZoneOrOffsetId ().toFormatter (Locale .ROOT ),
267
- new DateTimeFormatterBuilder ().appendPattern ("yyyyDDD" ).append (BASIC_T_TIME_PRINTER )
267
+ new DateTimeFormatterBuilder ().appendPattern ("yyyyDDD" ).append (BASIC_T_TIME_FORMATTER )
268
268
.appendZoneOrOffsetId ().toFormatter (Locale .ROOT ),
269
269
new DateTimeFormatterBuilder ().appendPattern ("yyyyDDD" ).append (BASIC_T_TIME_FORMATTER )
270
270
.append (TIME_ZONE_FORMATTER_NO_COLON ).toFormatter (Locale .ROOT )
@@ -371,7 +371,7 @@ public class DateFormatters {
371
371
.appendValue (HOUR_OF_DAY , 2 , 2 , SignStyle .NOT_NEGATIVE )
372
372
.appendValue (MINUTE_OF_HOUR , 2 , 2 , SignStyle .NOT_NEGATIVE )
373
373
.appendValue (SECOND_OF_MINUTE , 2 , 2 , SignStyle .NOT_NEGATIVE )
374
- .appendFraction (NANO_OF_SECOND , 3 , 3 , true )
374
+ .appendFraction (NANO_OF_SECOND , 3 , 9 , true )
375
375
.appendZoneOrOffsetId ()
376
376
.toFormatter (Locale .ROOT ),
377
377
new DateTimeFormatterBuilder ()
@@ -380,7 +380,7 @@ public class DateFormatters {
380
380
.appendValue (HOUR_OF_DAY , 2 , 2 , SignStyle .NOT_NEGATIVE )
381
381
.appendValue (MINUTE_OF_HOUR , 2 , 2 , SignStyle .NOT_NEGATIVE )
382
382
.appendValue (SECOND_OF_MINUTE , 2 , 2 , SignStyle .NOT_NEGATIVE )
383
- .appendFraction (NANO_OF_SECOND , 3 , 3 , true )
383
+ .appendFraction (NANO_OF_SECOND , 3 , 9 , true )
384
384
.append (TIME_ZONE_FORMATTER_NO_COLON )
385
385
.toFormatter (Locale .ROOT )
386
386
);
@@ -437,7 +437,7 @@ public class DateFormatters {
437
437
.appendLiteral ('T' )
438
438
.append (STRICT_HOUR_MINUTE_SECOND_FORMATTER )
439
439
.optionalStart ()
440
- .appendFraction (NANO_OF_SECOND , 3 , 3 , true )
440
+ .appendFraction (NANO_OF_SECOND , 3 , 9 , true )
441
441
.optionalEnd ()
442
442
.toFormatter (Locale .ROOT );
443
443
@@ -494,7 +494,7 @@ public class DateFormatters {
494
494
// NOTE: this is not a strict formatter to retain the joda time based behaviour, even though it's named like this
495
495
private static final DateTimeFormatter STRICT_HOUR_MINUTE_SECOND_MILLIS_FORMATTER = new DateTimeFormatterBuilder ()
496
496
.append (STRICT_HOUR_MINUTE_SECOND_FORMATTER )
497
- .appendFraction (NANO_OF_SECOND , 1 , 3 , true )
497
+ .appendFraction (NANO_OF_SECOND , 1 , 9 , true )
498
498
.toFormatter (Locale .ROOT );
499
499
500
500
private static final DateTimeFormatter STRICT_HOUR_MINUTE_SECOND_MILLIS_PRINTER = new DateTimeFormatterBuilder ()
@@ -532,12 +532,26 @@ public class DateFormatters {
532
532
.append (STRICT_YEAR_MONTH_DAY_FORMATTER )
533
533
.appendLiteral ("T" )
534
534
.append (STRICT_HOUR_MINUTE_SECOND_FORMATTER )
535
- // this one here is lenient as well to retain joda time based bwc compatibility
536
- .appendFraction (NANO_OF_SECOND , 1 , 3 , true )
535
+ // this one here is lenient as well to retain joda time based bwc compatibility
536
+ .appendFraction (NANO_OF_SECOND , 1 , 9 , true )
537
537
.toFormatter (Locale .ROOT )
538
538
);
539
539
540
- private static final DateFormatter STRICT_DATE_HOUR_MINUTE_SECOND_MILLIS = STRICT_DATE_HOUR_MINUTE_SECOND_FRACTION ;
540
+ private static final DateFormatter STRICT_DATE_HOUR_MINUTE_SECOND_MILLIS = new JavaDateFormatter (
541
+ "strict_date_hour_minute_second_millis" ,
542
+ new DateTimeFormatterBuilder ()
543
+ .append (STRICT_YEAR_MONTH_DAY_FORMATTER )
544
+ .appendLiteral ("T" )
545
+ .append (STRICT_HOUR_MINUTE_SECOND_MILLIS_PRINTER )
546
+ .toFormatter (Locale .ROOT ),
547
+ new DateTimeFormatterBuilder ()
548
+ .append (STRICT_YEAR_MONTH_DAY_FORMATTER )
549
+ .appendLiteral ("T" )
550
+ .append (STRICT_HOUR_MINUTE_SECOND_FORMATTER )
551
+ // this one here is lenient as well to retain joda time based bwc compatibility
552
+ .appendFraction (NANO_OF_SECOND , 1 , 9 , true )
553
+ .toFormatter (Locale .ROOT )
554
+ );
541
555
542
556
/*
543
557
* Returns a formatter for a two digit hour of day. (HH)
@@ -561,7 +575,7 @@ public class DateFormatters {
561
575
.optionalStart ()
562
576
.appendLiteral (':' )
563
577
.appendValue (SECOND_OF_MINUTE , 2 , 2 , SignStyle .NOT_NEGATIVE )
564
- .appendFraction (NANO_OF_SECOND , 3 , 3 , true )
578
+ .appendFraction (NANO_OF_SECOND , 3 , 9 , true )
565
579
.optionalEnd ()
566
580
.toFormatter (Locale .ROOT );
567
581
@@ -585,7 +599,7 @@ public class DateFormatters {
585
599
.appendValue (MINUTE_OF_HOUR , 2 , 2 , SignStyle .NOT_NEGATIVE )
586
600
.appendLiteral (':' )
587
601
.appendValue (SECOND_OF_MINUTE , 2 , 2 , SignStyle .NOT_NEGATIVE )
588
- .appendFraction (NANO_OF_SECOND , 1 , 3 , true )
602
+ .appendFraction (NANO_OF_SECOND , 1 , 9 , true )
589
603
.toFormatter (Locale .ROOT );
590
604
591
605
private static final DateTimeFormatter STRICT_TIME_PRINTER = new DateTimeFormatterBuilder ()
@@ -816,7 +830,7 @@ public class DateFormatters {
816
830
.appendValue (SECOND_OF_MINUTE , 1 , 2 , SignStyle .NOT_NEGATIVE )
817
831
.optionalEnd ()
818
832
.optionalStart ()
819
- .appendFraction (NANO_OF_SECOND , 1 , 3 , true )
833
+ .appendFraction (NANO_OF_SECOND , 1 , 9 , true )
820
834
.optionalEnd ()
821
835
.optionalStart ().appendZoneOrOffsetId ().optionalEnd ()
822
836
.optionalStart ().appendOffset ("+HHmm" , "Z" ).optionalEnd ()
@@ -840,6 +854,15 @@ public class DateFormatters {
840
854
.appendFraction (NANO_OF_SECOND , 1 , 3 , true )
841
855
.toFormatter (Locale .ROOT );
842
856
857
+ private static final DateTimeFormatter HOUR_MINUTE_SECOND_FRACTION_FORMATTER = new DateTimeFormatterBuilder ()
858
+ .appendValue (HOUR_OF_DAY , 1 , 2 , SignStyle .NOT_NEGATIVE )
859
+ .appendLiteral (':' )
860
+ .appendValue (MINUTE_OF_HOUR , 1 , 2 , SignStyle .NOT_NEGATIVE )
861
+ .appendLiteral (':' )
862
+ .appendValue (SECOND_OF_MINUTE , 1 , 2 , SignStyle .NOT_NEGATIVE )
863
+ .appendFraction (NANO_OF_SECOND , 1 , 9 , true )
864
+ .toFormatter (Locale .ROOT );
865
+
843
866
private static final DateTimeFormatter ORDINAL_DATE_FORMATTER = new DateTimeFormatterBuilder ()
844
867
.appendValue (ChronoField .YEAR , 4 , 10 , SignStyle .EXCEEDS_PAD )
845
868
.appendLiteral ('-' )
@@ -872,7 +895,7 @@ public class DateFormatters {
872
895
873
896
private static final DateTimeFormatter TIME_PREFIX = new DateTimeFormatterBuilder ()
874
897
.append (TIME_NO_MILLIS_FORMATTER )
875
- .appendFraction (NANO_OF_SECOND , 1 , 3 , true )
898
+ .appendFraction (NANO_OF_SECOND , 1 , 9 , true )
876
899
.toFormatter (Locale .ROOT );
877
900
878
901
private static final DateTimeFormatter WEEK_DATE_FORMATTER = new DateTimeFormatterBuilder ()
@@ -910,8 +933,7 @@ public class DateFormatters {
910
933
/*
911
934
* Returns a formatter that combines a full date, two digit hour of day,
912
935
* two digit minute of hour, two digit second of minute, and three digit
913
- * fraction of second (yyyy-MM-dd'T'HH:mm:ss.SSS). Parsing will parse up
914
- * to 3 fractional second digits.
936
+ * fraction of second (yyyy-MM-dd'T'HH:mm:ss.SSS).
915
937
*/
916
938
private static final DateFormatter DATE_HOUR_MINUTE_SECOND_MILLIS =
917
939
new JavaDateFormatter ("date_hour_minute_second_millis" ,
@@ -926,7 +948,18 @@ public class DateFormatters {
926
948
.append (HOUR_MINUTE_SECOND_MILLIS_FORMATTER )
927
949
.toFormatter (Locale .ROOT ));
928
950
929
- private static final DateFormatter DATE_HOUR_MINUTE_SECOND_FRACTION = DATE_HOUR_MINUTE_SECOND_MILLIS ;
951
+ private static final DateFormatter DATE_HOUR_MINUTE_SECOND_FRACTION =
952
+ new JavaDateFormatter ("date_hour_minute_second_fraction" ,
953
+ new DateTimeFormatterBuilder ()
954
+ .append (STRICT_YEAR_MONTH_DAY_FORMATTER )
955
+ .appendLiteral ("T" )
956
+ .append (STRICT_HOUR_MINUTE_SECOND_MILLIS_PRINTER )
957
+ .toFormatter (Locale .ROOT ),
958
+ new DateTimeFormatterBuilder ()
959
+ .append (DATE_FORMATTER )
960
+ .appendLiteral ("T" )
961
+ .append (HOUR_MINUTE_SECOND_FRACTION_FORMATTER )
962
+ .toFormatter (Locale .ROOT ));
930
963
931
964
/*
932
965
* Returns a formatter that combines a full date, two digit hour of day,
@@ -960,7 +993,7 @@ public class DateFormatters {
960
993
.optionalStart ()
961
994
.appendLiteral (':' )
962
995
.appendValue (SECOND_OF_MINUTE , 1 , 2 , SignStyle .NOT_NEGATIVE )
963
- .appendFraction (NANO_OF_SECOND , 1 , 3 , true )
996
+ .appendFraction (NANO_OF_SECOND , 1 , 9 , true )
964
997
.optionalEnd ()
965
998
.toFormatter (Locale .ROOT );
966
999
@@ -1031,6 +1064,9 @@ public class DateFormatters {
1031
1064
private static final DateFormatter HOUR_MINUTE_SECOND_MILLIS = new JavaDateFormatter ("hour_minute_second_millis" ,
1032
1065
STRICT_HOUR_MINUTE_SECOND_MILLIS_PRINTER , HOUR_MINUTE_SECOND_MILLIS_FORMATTER );
1033
1066
1067
+ private static final DateFormatter HOUR_MINUTE_SECOND_FRACTION = new JavaDateFormatter ("hour_minute_second_fraction" ,
1068
+ STRICT_HOUR_MINUTE_SECOND_MILLIS_PRINTER , HOUR_MINUTE_SECOND_FRACTION_FORMATTER );
1069
+
1034
1070
/*
1035
1071
* Returns a formatter for a two digit hour of day and two digit minute of
1036
1072
* hour. (HH:mm)
@@ -1065,7 +1101,7 @@ public class DateFormatters {
1065
1101
.optionalStart ()
1066
1102
.appendLiteral (':' )
1067
1103
.appendValue (SECOND_OF_MINUTE , 1 , 2 , SignStyle .NOT_NEGATIVE )
1068
- .appendFraction (NANO_OF_SECOND , 1 , 3 , true )
1104
+ .appendFraction (NANO_OF_SECOND , 1 , 9 , true )
1069
1105
.optionalEnd ()
1070
1106
.toFormatter (Locale .ROOT );
1071
1107
@@ -1329,7 +1365,7 @@ public static DateFormatter forPattern(String input) {
1329
1365
} else if ("hourMinuteSecond" .equals (input ) || "hour_minute_second" .equals (input )) {
1330
1366
return HOUR_MINUTE_SECOND ;
1331
1367
} else if ("hourMinuteSecondFraction" .equals (input ) || "hour_minute_second_fraction" .equals (input )) {
1332
- return HOUR_MINUTE_SECOND_MILLIS ;
1368
+ return HOUR_MINUTE_SECOND_FRACTION ;
1333
1369
} else if ("hourMinuteSecondMillis" .equals (input ) || "hour_minute_second_millis" .equals (input )) {
1334
1370
return HOUR_MINUTE_SECOND_MILLIS ;
1335
1371
} else if ("ordinalDate" .equals (input ) || "ordinal_date" .equals (input )) {
0 commit comments