A DESCRIPTION OF THE PROBLEM :
In DayOfWeek#plus
>The calculation rolls around the end of the *week* from Sunday to Monday. The specified period may be negative.
But in DayOfWeek#minus
>The calculation rolls around the start of the *year* from Monday to Sunday. The specified period may be negative.
year is should be a typo here
https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/time/DayOfWeek.html#minus(long)
This happens since Java 8
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Update the method document to
"The calculation rolls around the start of the week from Monday to Sunday. The specified period may be negative."
FREQUENCY : always
In DayOfWeek#plus
>The calculation rolls around the end of the *week* from Sunday to Monday. The specified period may be negative.
But in DayOfWeek#minus
>The calculation rolls around the start of the *year* from Monday to Sunday. The specified period may be negative.
year is should be a typo here
https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/time/DayOfWeek.html#minus(long)
This happens since Java 8
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Update the method document to
"The calculation rolls around the start of the week from Monday to Sunday. The specified period may be negative."
FREQUENCY : always
- duplicates
-
JDK-8326158 Javadoc for java.time.DayOfWeek#minus(long)
- Resolved