mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-23 08:18:52 -05:00
avoid time zone issues by interpreting all dates and times as UTC
This commit is contained in:
parent
3e66ceee86
commit
07ea116518
@ -23,6 +23,7 @@ import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
@ -217,7 +218,9 @@ public class MediaBindingBean {
|
||||
SimpleDate releaseDate = getReleaseDate();
|
||||
|
||||
if (releaseDate != null) {
|
||||
long days = ChronoUnit.DAYS.between(releaseDate.toLocalDate(), LocalDateTime.now());
|
||||
// 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));
|
||||
|
||||
if (days >= 0) {
|
||||
return days;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user