aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-04-26 02:19:34 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-04-26 02:19:34 +0200
commitabace1311042214b5a73b06c04dc6adb4787d9ed (patch)
treed879cadb653a80a42a5b07f84510fd67c8ae1dd4
parentRemove days-between in favour of days-in-interval. (diff)
downloadcalp-abace1311042214b5a73b06c04dc6adb4787d9ed.tar.gz
calp-abace1311042214b5a73b06c04dc6adb4787d9ed.tar.xz
Move date-range to datetime/util.
-rw-r--r--module/datetime/util.scm7
-rw-r--r--module/output/html.scm5
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))))