diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-05-09 13:17:31 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-05-09 13:17:31 +0200 |
commit | 45edc9cd1be13899b9d65372480bbcd84511d314 (patch) | |
tree | f052b03b535b4d9af94e7f4214bcb0436a6f3543 /module | |
parent | Clean up util header. (diff) | |
download | calp-45edc9cd1be13899b9d65372480bbcd84511d314.tar.gz calp-45edc9cd1be13899b9d65372480bbcd84511d314.tar.xz |
Start work on making DTEND optional.optional-dtend
Diffstat (limited to '')
-rw-r--r-- | module/output/html.scm | 14 | ||||
-rw-r--r-- | module/vcomponent/datetime.scm | 1 | ||||
-rw-r--r-- | module/vcomponent/group.scm | 3 |
3 files changed, 11 insertions, 7 deletions
diff --git a/module/output/html.scm b/module/output/html.scm index 3b17d81b..b7e369a7 100644 --- a/module/output/html.scm +++ b/module/output/html.scm @@ -94,12 +94,14 @@ ;; no end value, just return start [else (date->string s)]))] [else ; guaranteed datetime - (let ((s (attr ev 'DTSTART)) - (e (attr ev 'DTEND))) - (let ((fmt-str (if (date= (get-date s) (get-date e)) - "~H:~M" "~Y-~m-~d ~H:~M"))) - (values (datetime->string s fmt-str) - (datetime->string e fmt-str))))])) + (let ((s (attr ev 'DTSTART))) + (cond [(attr ev 'DTEND) + => (lambda (e) + (let ((fmt-str (if (date= (get-date s) (get-date e)) + "~H:~M" "~Y-~m-~d ~H:~M"))) + (values (datetime->string s fmt-str) + (datetime->string e fmt-str))))] + [else (datetime->string s "~Y-~m-~d ~H:~M")]))])) diff --git a/module/vcomponent/datetime.scm b/module/vcomponent/datetime.scm index 44776516..7fc22066 100644 --- a/module/vcomponent/datetime.scm +++ b/module/vcomponent/datetime.scm @@ -107,6 +107,7 @@ Event must have the DTSTART and DTEND attribute set." (define-public (long-event? ev) (or (date? (attr ev 'DTSTART)) (datetime<= (datetime date: (date day: 1)) + ;; TODO DTEND optional (datetime-difference (attr ev 'DTEND) (attr ev 'DTSTART))))) diff --git a/module/vcomponent/group.scm b/module/vcomponent/group.scm index 1e5728c6..da912e4d 100644 --- a/module/vcomponent/group.scm +++ b/module/vcomponent/group.scm @@ -26,7 +26,8 @@ ;; of tommorow, and finishes with the rest when it finds the first ;; object which begins tomorow (after midnight, exclusize). (filter-sorted-stream* - (lambda (e) (date/-time<? tomorow (attr e 'DTEND))) + ;; TODO Calculate Alternative DTEND better? + (lambda (e) (date/-time<? tomorow (or (attr e 'DTEND) (attr e 'DTSTART)))) (lambda (e) (date/-time<=? tomorow (attr e 'DTSTART))) stream))) |