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 +++++++ 1 file changed, 7 insertions(+) (limited to 'module/datetime') 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" -- cgit v1.2.3