Skip to content

Commit

Permalink
use month names instead of numbers
Browse files Browse the repository at this point in the history
Calendar uses 0-11 and LocalDate uses 1-12, so use constants to avoid confusion.
  • Loading branch information
asgh authored and Ariel Shkedi committed Aug 20, 2024
1 parent 26a0991 commit 3e77e20
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.time.LocalDate;
import java.time.Month;
import java.util.Calendar;
import java.util.Locale;
import java.util.GregorianCalendar;
Expand Down Expand Up @@ -90,8 +91,8 @@ public void testGetYear() {
public void testToLocalDate() {
Calendar calendar = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
calendar.setTimeInMillis(-27078001200000L);
assertEquals(LocalDate.of(1111, 12, 1), new CalendarUtils(calendar).toLocalDate());
assertEquals(LocalDate.of(1111, Month.DECEMBER, 1), new CalendarUtils(calendar).toLocalDate());
calendar.setTimeInMillis(1614700215000L);
assertEquals(LocalDate.of(2021, 3, 2), new CalendarUtils(calendar).toLocalDate());
assertEquals(LocalDate.of(2021, Month.MARCH, 2), new CalendarUtils(calendar).toLocalDate());
}
}

0 comments on commit 3e77e20

Please sign in to comment.