diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-04-06 19:08:59 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-04-13 00:14:55 +0200 |
commit | 59f6fc205b19f0cd2253adb7c656c4eda904a52e (patch) | |
tree | 2390a02195fdae3d79aa2b39d39e134c93871e3c /module/vcalendar/datetime.scm | |
parent | Rework how attributes and properties are accessed. (diff) | |
download | calp-59f6fc205b19f0cd2253adb7c656c4eda904a52e.tar.gz calp-59f6fc205b19f0cd2253adb7c656c4eda904a52e.tar.xz |
Add earlier work on timezones.
Add earlier work on timezones, with a few inline modifications. This is
really to big of a commit. But we are so far from a stable release that
it should be fine.
The current version seems to eager, and recalculates to many times. This
will soon be fixed in a future version.
Diffstat (limited to '')
-rw-r--r-- | module/vcalendar/datetime.scm | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/module/vcalendar/datetime.scm b/module/vcalendar/datetime.scm index f6df03d5..9b1cc82d 100644 --- a/module/vcalendar/datetime.scm +++ b/module/vcalendar/datetime.scm @@ -2,22 +2,24 @@ #:use-module (vcalendar) #:use-module (srfi srfi-19) #:use-module (srfi srfi-19 util) + #:use-module (util) #:export (parse-datetime event-overlaps? - event-in?) + event-in? + ev-time<?) ) +;;; date time pointer (define (parse-datetime dtime) "Parse the given date[time] string into a date object." - ;; localize-date - (date->time-utc - (string->date - dtime - (case (string-length dtime) - ((8) "~Y~m~d") - ((15) "~Y~m~dT~H~M~S") - ((16) "~Y~m~dT~H~M~S~z"))))) + (let* ((str type (case (string-length dtime) + ((8) (values "~Y~m~d" 'all-day)) ; All day + ((15) (values "~Y~m~dT~H~M~S" 'local)) ; "local" or TZID-param + ((16) (values "~Y~m~dT~H~M~S~z" 'utc)) ; UTC-time + )) + (date (string->date dtime str))) + (values date type))) (define (event-overlaps? event begin end) "Returns if the event overlaps the timespan. @@ -33,6 +35,6 @@ Event must have the DTSTART and DTEND attribute set." (end (add-day start))) (event-overlaps? ev start end))) -(define-public (ev-time<? a b) +(define (ev-time<? a b) (time<? (attr a 'DTSTART) (attr b 'DTSTART))) |