1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-05 17:05:04 -05:00

avoid time zone issues by interpreting all dates and times as UTC

This commit is contained in:
Reinhard Pointner 2016-12-27 14:23:24 +08:00
parent 07ea116518
commit dd3a87e985

View File

@ -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;