From 6c2f567d311a80ada265f026cec800309efbeaaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 29 Nov 2020 22:57:06 +0100 Subject: Generated xcal now has by*-rules correct. --- module/vcomponent/recurrence/internal.scm | 33 +++++++++++++++++++++---------- static/rrule.js | 7 +------ 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/module/vcomponent/recurrence/internal.scm b/module/vcomponent/recurrence/internal.scm index 1a2abd85..8e84a8b6 100644 --- a/module/vcomponent/recurrence/internal.scm +++ b/module/vcomponent/recurrence/internal.scm @@ -88,8 +88,8 @@ (string-upcase (week-day-name value 2 locale: (make-locale (list LC_TIME) "C")))] - [(byday) - (string-join (map byday->string value) ",")] + ;; [(byday) + ;; (string-join (map byday->string value) ",")] [(freq count interval) (format #f "~a" value)] [(until) @@ -120,14 +120,27 @@ (define-public (recur-rule->rrule-sxml rrule) (map-fields (lambda (field value) - (if (string-ci=? "UNTIL" (symbol->string field)) - `(until - ,(if (date? value) - (date->string value "~Y-~m-~d") - (datetime->string - value "~Y-~m-~dT~H:~M:~S~Z"))) - `(,(downcase-symbol field) - ,(field->string field value)))) + (cond [(string-ci=? "UNTIL" (symbol->string field)) + `(until + ,(if (date? value) + (date->string value "~Y-~m-~d") + (datetime->string + value "~Y-~m-~dT~H:~M:~S~Z")))] + [(string-ci=? "BYDAY" (symbol->string field)) + (map (lambda (v) + `(,(downcase-symbol field) + ,(byday->string v))) + value) + ] + [(string-ci=? "BY" (substring (symbol->string field) + 0 2)) + (map (lambda (v) + `(,(downcase-symbol field) + ,v)) + value)] + [else + `(,(downcase-symbol field) + ,(field->string field value))])) rrule)) diff --git a/static/rrule.js b/static/rrule.js index 2f2120e3..abc648af 100644 --- a/static/rrule.js +++ b/static/rrule.js @@ -19,12 +19,6 @@ class RRule { 'bymonthday', 'byyearday', 'byweekno', 'bymonth', 'bysetpos', 'wkst'] - /* - TODO multi valued byhour should be represented as - 12 - NOT as 1,2 as it currently does. - */ - constructor() { this.listeners = {} @@ -37,6 +31,7 @@ class RRule { TODO many of the fields should be wrapped in type tags. e.g. elements are either or , NOT a raw date. + by* fields should be wrapped with multiple values. */ get: () => this['_' + f], set: (v) => { -- cgit v1.2.3