From dd3a87e98569e4d615ae21b2f488bb4b47406aeb Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Tue, 27 Dec 2016 14:23:24 +0800 Subject: [PATCH] avoid time zone issues by interpreting all dates and times as UTC --- source/net/filebot/format/MediaBindingBean.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/net/filebot/format/MediaBindingBean.java b/source/net/filebot/format/MediaBindingBean.java index 99b8a503..e24f40fb 100644 --- a/source/net/filebot/format/MediaBindingBean.java +++ b/source/net/filebot/format/MediaBindingBean.java @@ -22,6 +22,7 @@ import java.io.File; import java.io.IOException; import java.math.BigDecimal; import java.math.RoundingMode; +import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneOffset; import java.time.ZonedDateTime; @@ -219,7 +220,7 @@ public class MediaBindingBean { if (releaseDate != null) { // avoid time zone issues by interpreting all dates and times as UTC - long days = ChronoUnit.DAYS.between(releaseDate.toLocalDate().atStartOfDay(ZoneOffset.UTC), ZonedDateTime.now(ZoneOffset.UTC)); + long days = ChronoUnit.DAYS.between(releaseDate.toLocalDate().atStartOfDay(ZoneOffset.UTC).toInstant(), Instant.now()); if (days >= 0) { return days;