A DESCRIPTION OF THE PROBLEM :
The example included in the documentation of method minusYears of class LocalDateTime adds a year instead of subtracting it.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Access https://docs.oracle.com/javase/8/docs/api/java/time/LocalDateTime.html#minusYears-long-
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
"For example, 2008-02-29 (leap year) minus one year would result in the invalid date 2007-02-29 (standard year). Instead of returning an invalid result, the last valid day of the month, 2007-02-28, is selected instead."
ACTUAL -
"For example, 2008-02-29 (leap year) minus one year would result in the invalid date 2009-02-29 (standard year). Instead of returning an invalid result, the last valid day of the month, 2009-02-28, is selected instead."
The example included in the documentation of method minusYears of class LocalDateTime adds a year instead of subtracting it.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Access https://docs.oracle.com/javase/8/docs/api/java/time/LocalDateTime.html#minusYears-long-
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
"For example, 2008-02-29 (leap year) minus one year would result in the invalid date 2007-02-29 (standard year). Instead of returning an invalid result, the last valid day of the month, 2007-02-28, is selected instead."
ACTUAL -
"For example, 2008-02-29 (leap year) minus one year would result in the invalid date 2009-02-29 (standard year). Instead of returning an invalid result, the last valid day of the month, 2009-02-28, is selected instead."
- duplicates
-
JDK-8160036 Java API doc for method minusMonths in LocalDateTime class needs correction
-
- Closed
-