4747import java .util .Collections ;
4848import java .util .List ;
4949import java .util .Map ;
50+ import java .util .function .BiConsumer ;
5051import java .util .function .BiFunction ;
5152import java .util .function .BinaryOperator ;
53+ import java .util .function .Consumer ;
5254import java .util .function .DoubleFunction ;
5355import java .util .function .Function ;
5456import java .util .function .IntFunction ;
@@ -1159,9 +1161,16 @@ public static List<TypedDataSupplier> dateCases(Instant min, Instant max) {
11591161 */
11601162 public static List <TypedDataSupplier > dateCases (long min , long max ) {
11611163 List <TypedDataSupplier > cases = new ArrayList <>();
1162- if (min <= 0 && max >= 0 ) {
1163- cases .add (new TypedDataSupplier ("<1970-01-01T00:00:00Z>" , () -> 0L , DataType .DATETIME ));
1164- }
1164+ Consumer <String > addExactCase = (value ) -> {
1165+ long date = Instant .parse (value ).toEpochMilli ();
1166+ if (date >= min && date <= max ) {
1167+ cases .add (new TypedDataSupplier ("<" + value + ">" , () -> date , DataType .DATETIME ));
1168+ }
1169+ };
1170+
1171+ addExactCase .accept ("1970-01-01T00:00:00Z" );
1172+ addExactCase .accept ("2025-03-30T01:00:00+01:00" ); // Before Europe/Paris DST change
1173+ addExactCase .accept ("2025-03-30T03:00:00+02:00" ); // After Europe/Paris DST change
11651174
11661175 // 1970-01-01T00:00:00Z - 2286-11-20T17:46:40Z
11671176 long lower1 = Math .max (min , 0 );
@@ -1186,6 +1195,8 @@ public static List<TypedDataSupplier> dateCases(long min, long max) {
11861195 );
11871196 }
11881197
1198+
1199+
11891200 return cases ;
11901201 }
11911202
@@ -1218,11 +1229,17 @@ public static List<TypedDataSupplier> dateNanosCases(Instant minValue, Instant m
12181229 Instant twentyTwoFifty = Instant .parse ("2250-01-01T00:00:00Z" );
12191230
12201231 List <TypedDataSupplier > cases = new ArrayList <>();
1221- if (minValue .isAfter (Instant .EPOCH ) == false ) {
1222- cases .add (
1223- new TypedDataSupplier ("<1970-01-01T00:00:00.000000000Z>" , () -> DateUtils .toLong (Instant .EPOCH ), DataType .DATE_NANOS )
1224- );
1225- }
1232+ Consumer <String > addExactCase = (value ) -> {
1233+ Instant instant = Instant .parse (value );
1234+ long date = DateUtils .toLong (Instant .parse (value ));
1235+ if (minValue .isAfter (instant ) == false && maxValue .isBefore (instant ) == false ) {
1236+ cases .add (new TypedDataSupplier ("<" + value + ">" , () -> date , DataType .DATE_NANOS ));
1237+ }
1238+ };
1239+
1240+ addExactCase .accept ("1970-01-01T00:00:00.000000000Z" );
1241+ addExactCase .accept ("2025-03-30T01:00:00.000000001+01:00" ); // Before Europe/Paris DST change
1242+ addExactCase .accept ("2025-03-30T03:00:00.000000002+02:00" ); // After Europe/Paris DST change
12261243
12271244 Instant lower = Instant .EPOCH .isBefore (minValue ) ? minValue : Instant .EPOCH ;
12281245 Instant upper = twentyOneHundred .isAfter (maxValue ) ? maxValue : twentyOneHundred ;
0 commit comments