diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-06-13 03:18:22 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-06-13 03:18:22 +0200 |
commit | 87b01758078ecba793d122e896d711c377e65f1e (patch) | |
tree | 68e3aec7b153080975b198127cbb8274a33df4f8 /module/vcomponent/recurrence/generate.scm | |
parent | Which lead to some other bugs needing fixing. (diff) | |
download | calp-87b01758078ecba793d122e896d711c377e65f1e.tar.gz calp-87b01758078ecba793d122e896d711c377e65f1e.tar.xz |
All recurrence test except SETPOS now pass.
Diffstat (limited to '')
-rw-r--r-- | module/vcomponent/recurrence/generate.scm | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/module/vcomponent/recurrence/generate.scm b/module/vcomponent/recurrence/generate.scm index db612e38..5a4ef80b 100644 --- a/module/vcomponent/recurrence/generate.scm +++ b/module/vcomponent/recurrence/generate.scm @@ -50,7 +50,10 @@ (match-lambda [('unless pred field) `(let ((yearday (,(by-proc 'yearday) ,rr)) - (monthday (,(by-proc 'monthday) ,rr))) + (monthday (,(by-proc 'monthday) ,rr)) + (weekno (,(by-proc 'weekno) ,rr)) + (month (,(by-proc 'month) ,rr)) + ) (if ,pred #f ,(self field)))] [field @@ -75,7 +78,15 @@ (make-extenders rrule [YEARLY || month weekno yearday monthday - (unless (or yearday monthday) day) + + ;; see Note 2, p. 44 + (unless (or yearday monthday + ;; weekno and month are still expanders. They however + ;; cause day to be omited here to prevent datetimes + ;; from being generated from both directions. + ;; They are instead handled under BYWEEKNO & BYMONTH + ;; respectively. + weekno month) day) hour minute second] [MONTHLY || monthday (unless monthday day) hour minute second] [WEEKLY || day hour minute second] @@ -178,26 +189,13 @@ Possibly stuck in infinite loop") dt)))] - ;; see Note 2, p. 44 [(YEARLY) - (cond - - ;; turns it into a limiter - [(or (byyearday rrule) (bymonthday rrule)) - dt] - - ;; TODO this leads to duplicates in the output - [(or (byweekno rrule) (bymonth rrule)) - ;; Handled under BYWEEKNO & BYMONTH respectively - dt] - - [else - (let ((instances (all-wday-in-year - value (start-of-year d)))) - (to-dt - (if (positive? offset) - (list-ref instances (1- offset)) - (list-ref (reverse instances) (1- (- offset))))))]) + (let ((instances (all-wday-in-year + value (start-of-year d)))) + (to-dt + (if (positive? offset) + (list-ref instances (1- offset)) + (list-ref (reverse instances) (1- (- offset)))))) ]))] [(BYWEEKNO) |