From 5c4b8125ed37d9a883fdb4aa4bf88e962b6da8ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 29 Dec 2019 01:06:24 +0100 Subject: HTML day highlight now only in current month. --- module/output/html.scm | 10 +++++----- module/srfi/srfi-19/util.scm | 13 +++++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/module/output/html.scm b/module/output/html.scm index 0682bc6e..fc4199ee 100644 --- a/module/output/html.scm +++ b/module/output/html.scm @@ -258,11 +258,11 @@ (iota month-start (- prev-month-len month-start))) (map (lambda (p) `(td (@ ,@(assq-merge '((class " cur ")) (cdar p))) ,@(cdr p))) - ;; TODO only today in current month - (map (lambda (d) `((@ (class ,(when (= d (date-day today)) "today"))) - (a (@ (href "#" ,(date->string date "~Y-~m-") - ,(pad0 d)) - (class "hidelink")) ,d))) + (map (lambda (d) `((@ (class ,(when (date=? today (set (date-day date) d)) + "today"))) + (a (@ (href "#" ,(date->string date "~Y-~m-") + ,(pad0 d)) + (class "hidelink")) ,d))) (iota month-len 1))) (map (td '(class "next") (month+ date)) (iota (modulo (- (* 7 5) month-len month-start) 7) 1)))))) diff --git a/module/srfi/srfi-19/util.scm b/module/srfi/srfi-19/util.scm index 09900bf2..e34b9339 100644 --- a/module/srfi/srfi-19/util.scm +++ b/module/srfi/srfi-19/util.scm @@ -166,3 +166,16 @@ attribute set to 0. Can also be seen as \"Start of day\"" (define* (date #:key (year 0) (month 0) (day 0) (hour 0) (minute 0) (second 0) (nsecs 0) (zone 0)) (make-date nsecs second minute hour day month year zone)) + + +(define-public (date=? a b) + + (and (= (year a) (year b)) + (= (month a) (month b)) + (= (day a) (day b)) + ;; (= (hour a) (hour b)) + ;; (= (minute a) (minute b)) + ;; (= (second a) (second b)) + ) + ;; ( (nsecs b) (zone b)) + ) -- cgit v1.2.3