From a3cc0ec252c8ee8cb28849c113cbcf9f6ed75acf Mon Sep 17 00:00:00 2001 From: Thomas Molines Date: Tue, 23 Jun 2020 16:05:33 +0200 Subject: [PATCH] Fix daysOld miscalculation with summertime timezone --- assertion/compare.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assertion/compare.go b/assertion/compare.go index 8f304a9..4e76a6b 100644 --- a/assertion/compare.go +++ b/assertion/compare.go @@ -3,6 +3,7 @@ package assertion import ( "strconv" "time" + "math" ) func intCompare(n1 int, n2 int) int { @@ -22,7 +23,7 @@ func daysOld(data interface{}) int { if err != nil { return 0 } - days := int(time.Since(t).Hours() / 24.0) + days := int(math.Round(time.Since(t).Hours() / 24.0)) Debugf("Date: %v Days ago: %d\n", data, days) return days }