From 41758ba541ba70f243f6094aeeb197bcad7cc080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 12 Apr 2022 02:20:07 +0200 Subject: datetime->decimal-hour correct time for hours without days. --- module/datetime.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module') diff --git a/module/datetime.scm b/module/datetime.scm index 140c05db..5d953cad 100644 --- a/module/datetime.scm +++ b/module/datetime.scm @@ -560,7 +560,7 @@ (let ((date-diff (cond [start-date (let* ((end-date (date+ start-date (get-date dt)))) - (days-in-interval start-date end-date)) ] + (1- (days-in-interval start-date end-date))) ] [(or (not (zero? (month (get-date dt)))) (not (zero? (year (get-date dt))))) (scm-error 'misc-error "datetime->decimal-hour" @@ -569,7 +569,7 @@ #f)] [else (day (get-date dt))]))) (+ (time->decimal-hour (get-time% dt)) - (* (1- date-diff) 24)))) + (* date-diff 24)))) ;; Returns a list of all dates from start to end. ;; both inclusive -- cgit v1.2.3