aboutsummaryrefslogtreecommitdiff
path: root/module
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2020-02-14 00:23:49 +0100
committerHugo Hörnquist <hugo@hornquist.se>2020-02-14 00:23:49 +0100
commit21e5ec22fb810782003dcccf327d140465ac18c0 (patch)
tree1856e503b3494f4456a91d53681aba47ffcd66c1 /module
parentCleanup and tests. (diff)
downloadcalp-21e5ec22fb810782003dcccf327d140465ac18c0.tar.gz
calp-21e5ec22fb810782003dcccf327d140465ac18c0.tar.xz
Reimplement date/time formatting in event list.
Diffstat (limited to 'module')
-rw-r--r--module/output/html.scm19
1 files changed, 8 insertions, 11 deletions
diff --git a/module/output/html.scm b/module/output/html.scm
index 42290ed9..48dd27f9 100644
--- a/module/output/html.scm
+++ b/module/output/html.scm
@@ -174,17 +174,14 @@
(date->string e))))]
[else (date->string s)]))]
[else ; guaranteed datetime
- ;; TODO rewrite this
- (values (time->string (get-time (attr ev 'DTSTART)))
- (time->string (get-time (attr ev 'DTEND))))
- #;
- (let* ((fmt (if (date/-time<? (time- (attr ev 'DTEND) (attr ev 'DTSTART))
- (time hour: 24))
- "~H:~M" "~Y-~m-~d ~H:~M"))
- ;; TODO write these
- (start (date/-time->string (attr ev 'DTSTART) fmt))
- (end (date/-time->string (attr ev 'DTEND) fmt)))
- (values start end))]))
+ (let ((s (attr ev 'DTSTART))
+ (e (attr ev 'DTEND)))
+ (let ((s-str (time->string (get-time s) "~H:~M"))
+ (e-str (time->string (get-time e) "~H:~M")))
+ (if (date= (get-date s) (get-date e))
+ (values s-str e-str)
+ (values (string-append (date->string (get-date s) "~Y-~m-~d ") s-str)
+ (string-append (date->string (get-date e) "~Y-~m-~d ") e-str)))))]))
;; For sidebar, just text