I use java.time.Period#getDays()
to get the number of days for a given period of LocalDate
s.
It seems to work for most cases, but for a whole month, I get a period of zero days.
The following test case fails (java.lang.AssertionError: expected:<30> but was:<0>
):
@Test
public void testOneMonthPeriodDays() {
Period p = Period.between(LocalDate.of(2017, 06, 01), LocalDate.of(2017, 07, 01));
assertEquals(30, p.getDays());
}