BAEL-2234 Dates difference with ZonedDateTimes (#5445)

This commit is contained in:
Darío Carrasquel 2018-10-14 01:33:39 -05:00 committed by Josh Cummings
parent c9f2162f98
commit 79285e3cc6
1 changed files with 9 additions and 0 deletions

View File

@ -51,6 +51,15 @@ public class DateDiffUnitTest {
assertEquals(diff, 6);
}
@Test
public void givenTwoZonedDateTimesInJava8_whenDifferentiating_thenWeGetSix() {
LocalDateTime ldt = LocalDateTime.now();
ZonedDateTime now = ldt.atZone(ZoneId.of("America/Montreal"));
ZonedDateTime sixDaysBehind = now.withZoneSameInstant(ZoneId.of("Asia/Singapore")).minusDays(6);
long diff = ChronoUnit.DAYS.between(sixDaysBehind, now);
assertEquals(diff, 6);
}
@Test
public void givenTwoDatesInJodaTime_whenDifferentiating_thenWeGetSix() {
org.joda.time.LocalDate now = org.joda.time.LocalDate.now();