java.timeconstants will always throw a
Calling any method of the
java.time package with invalid constant values will throw a
LocalDate date = LocalDate.of(1985, Month.MAY, 32);
In the code above, the
LocalDate object is instantiated with a day-of-month value of
32, which is a plainly invalid day of any month. This will result in a
DateTimeException at runtime.
Use values within the valid range for the specific date/time field when calling such methods.
LocalDate date = LocalDate.of(1985, Month.MAY, 31);