Fixed computation of day delta.
@@ -2,8 +2,8 @@ package io.jenkins.plugins.analysis.core.graphs;
import java.time.Instant;
import java.time.LocalDate;
-import java.time.Period;
import java.time.ZoneId;
+import java.time.temporal.ChronoUnit;
import com.google.common.annotations.VisibleForTesting;
@@ -51,9 +51,8 @@ public class ResultTime {
return configuration.isDayCountDefined() && computeDayDelta(analysisRun) > configuration.getDayCount();
}
- // FIXME: compute day delta computation
- private int computeDayDelta(final AnalysisResult analysisRun) {
- return Math.abs(Period.between(toLocalDate(analysisRun.getBuild().getTimeInMillis()), today).getDays());
+ private long computeDayDelta(final AnalysisResult result) {
+ return Math.abs(ChronoUnit.DAYS.between(toLocalDate(result.getBuild().getTimeInMillis()), today));
}
private LocalDate toLocalDate(final long timeInMillis) {
