BAEL-2234 Dates difference with ZonedDateTimes (#5445)
This commit is contained in:
parent
c9f2162f98
commit
79285e3cc6
@ -51,6 +51,15 @@ public class DateDiffUnitTest {
|
|||||||
assertEquals(diff, 6);
|
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
|
@Test
|
||||||
public void givenTwoDatesInJodaTime_whenDifferentiating_thenWeGetSix() {
|
public void givenTwoDatesInJodaTime_whenDifferentiating_thenWeGetSix() {
|
||||||
org.joda.time.LocalDate now = org.joda.time.LocalDate.now();
|
org.joda.time.LocalDate now = org.joda.time.LocalDate.now();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user