diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-11-29 22:57:06 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-11-29 22:57:06 +0100 |
commit | 6c2f567d311a80ada265f026cec800309efbeaaf (patch) | |
tree | b26d738ef02a5101c8fd31e892b2c1917e373d09 | |
parent | getopt 'options' option on values. (diff) | |
download | calp-6c2f567d311a80ada265f026cec800309efbeaaf.tar.gz calp-6c2f567d311a80ada265f026cec800309efbeaaf.tar.xz |
Generated xcal now has by*-rules correct.
-rw-r--r-- | module/vcomponent/recurrence/internal.scm | 33 | ||||
-rw-r--r-- | 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 - <byhour>1</byhour><byhour>2</byhour> - NOT as <byhour>1,2</byhour> 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. <until> elements are either <date> or <date-time>, NOT a raw date. + by* fields should be wrapped with multiple values. */ get: () => this['_' + f], set: (v) => { |