From abace1311042214b5a73b06c04dc6adb4787d9ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 26 Apr 2020 02:19:34 +0200 Subject: Move date-range to datetime/util. --- module/datetime/util.scm | 7 +++++++ module/output/html.scm | 5 ----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/module/datetime/util.scm b/module/datetime/util.scm index 8c57636e..a55aba68 100644 --- a/module/datetime/util.scm +++ b/module/datetime/util.scm @@ -329,6 +329,13 @@ (+ (time->decimal-hour ((@ (datetime) get-time%) dt)) (* (1- date-diff) 24)))) +;; Returns a list of all dates from start to end. +;; both inclusive +;; date, date → [list date] +(define-public (date-range start end) + (stream->list + (stream-take-while (lambda (d) (date<= d end)) + (day-stream start)))) (define-config week-start sun "First day of week" diff --git a/module/output/html.scm b/module/output/html.scm index 307c0236..2b8f52a9 100644 --- a/module/output/html.scm +++ b/module/output/html.scm @@ -319,11 +319,6 @@ (lambda (e) (not (date< end-date (as-date (attr e 'DTSTART))))) events))) -;; date, date → [list date] -(define (date-range start end) - (stream->list - (stream-take-while (lambda (d) (date<= d end)) - (day-stream start)))) (define*-public (render-calendar key: events start-date end-date #:allow-other-keys) (let* ((long-events short-events (partition long-event? (stream->list (events-between start-date end-date events)))) -- cgit v1.2.3