ADDITIONAL SYSTEM INFORMATION :
OS: Window 10 enterprise 64 bit ( 10.0, version 17134)
JDK: java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
A DESCRIPTION OF THE PROBLEM :
ChronoUnit.DAYS.between return result is inconsistent when pass into different date instance of class, for example new Date() or LocalDate.of()
This is behaving as per the Java API documentation:
Returns:
the amount of time between temporal1Inclusive and temporal2Exclusive in terms of this unit; positive if temporal2Exclusive is later than temporal1Inclusive, negative if earlier.
but use Instant.ofEpochMilli(new Date(2015, 8, 16).getTime() and LocalDate.of(2015, 8, 16) pass into method of between. The inconsistent results were obtained.
REGRESSION : Last worked in version 8u181
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
-1416
-1416
ACTUAL -
-1416
-1417
---------- BEGIN SOURCE ----------
System.out.println(ChronoUnit.DAYS.between(LocalDate.of(2015, 8, 16), LocalDate.of(2011, 9, 30)));
System.out.println(ChronoUnit.DAYS.between(Instant.ofEpochMilli(new Date(2015, 8, 16).getTime()), Instant.ofEpochMilli(new Date(2011, 9, 30).getTime())));
---------- END SOURCE ----------
FREQUENCY : always
OS: Window 10 enterprise 64 bit ( 10.0, version 17134)
JDK: java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
A DESCRIPTION OF THE PROBLEM :
ChronoUnit.DAYS.between return result is inconsistent when pass into different date instance of class, for example new Date() or LocalDate.of()
This is behaving as per the Java API documentation:
Returns:
the amount of time between temporal1Inclusive and temporal2Exclusive in terms of this unit; positive if temporal2Exclusive is later than temporal1Inclusive, negative if earlier.
but use Instant.ofEpochMilli(new Date(2015, 8, 16).getTime() and LocalDate.of(2015, 8, 16) pass into method of between. The inconsistent results were obtained.
REGRESSION : Last worked in version 8u181
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
-1416
-1416
ACTUAL -
-1416
-1417
---------- BEGIN SOURCE ----------
System.out.println(ChronoUnit.DAYS.between(LocalDate.of(2015, 8, 16), LocalDate.of(2011, 9, 30)));
System.out.println(ChronoUnit.DAYS.between(Instant.ofEpochMilli(new Date(2015, 8, 16).getTime()), Instant.ofEpochMilli(new Date(2011, 9, 30).getTime())));
---------- END SOURCE ----------
FREQUENCY : always