diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-03-29 23:25:20 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-03-29 23:25:20 +0200 |
commit | 9d471cd6cdd182c01bb6d7a7c7e0318a2daa3372 (patch) | |
tree | 0bcc9ef8150e56a810704c6f27dc02aa23104609 /module/vcomponent | |
parent | Change some calendar names in example config. (diff) | |
download | calp-9d471cd6cdd182c01bb6d7a7c7e0318a2daa3372.tar.gz calp-9d471cd6cdd182c01bb6d7a7c7e0318a2daa3372.tar.xz |
Clarify error on bad RRULE's.
Diffstat (limited to 'module/vcomponent')
-rw-r--r-- | module/vcomponent/recurrence/generate.scm | 11 | ||||
-rw-r--r-- | module/vcomponent/recurrence/parse.scm | 5 |
2 files changed, 9 insertions, 7 deletions
diff --git a/module/vcomponent/recurrence/generate.scm b/module/vcomponent/recurrence/generate.scm index ce64e741..ee59ed04 100644 --- a/module/vcomponent/recurrence/generate.scm +++ b/module/vcomponent/recurrence/generate.scm @@ -120,7 +120,7 @@ ((e r) (or (and (not (until r)) (not (count r))) ; Never ending (and=> (count r) (negate zero?)) ; COUNT - (and=> (until r) (lambda (dt) ((if (date? dt) date<= date/-time<=) ; UNTIL + (and=> (until r) (lambda (dt) ((if (date? dt) date<= datetime<=) ; UNTIL (attr e 'DTSTART) dt)))))) ;; Event x Rule → next (Event, Rule) @@ -155,10 +155,11 @@ (date-difference end (attr event 'DTSTART)) (datetime-difference end (attr event 'DTSTART))))])) (if (attr event "RRULE") - (recur-event-stream event (parse-recurrence-rule - (attr event "RRULE") - (if (eq? 'DATE (and=> (prop (attr* event 'DTSTART) 'VALUE) car)) - parse-date parse-datetime))) + (recur-event-stream + event (parse-recurrence-rule + (attr event "RRULE") + (if (date? (attr event 'DTSTART)) + parse-date parse-datetime))) ;; TODO some events STANDARD and DAYLIGT doesn't have RRULE's, but rather ;; just mention the current part. Handle this stream-null)))) diff --git a/module/vcomponent/recurrence/parse.scm b/module/vcomponent/recurrence/parse.scm index a93b81df..97e5e980 100644 --- a/module/vcomponent/recurrence/parse.scm +++ b/module/vcomponent/recurrence/parse.scm @@ -48,8 +48,9 @@ `(else ,@body))) cases)))) -;; UNTIL must have the exact same value type as the DTSTART of the event from which -;; this string came. I have however seen exceptions to that rule... +;; RFC 5545, Section 3.3.10. Recurrence Rule, states that the UNTIL value MUST have +;; the same type as the DTSTART of the event (date or datetime). I have seen events +;; in the wild which didn't follow this. I consider that an user error. (define* (parse-recurrence-rule str optional: (datetime-parser parse-datetime)) (fold (lambda (kv o) |