aboutsummaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-10-03 00:47:50 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2021-10-03 00:47:50 +0200
commita31bfa6686eb52506d600a5b77a96fddeb9fb344 (patch)
treed1b7639917740ac5413230b9852319c06454555f /static
parentReintroduce dateonly for date-time-input:s. (diff)
downloadcalp-a31bfa6686eb52506d600a5b77a96fddeb9fb344.tar.gz
calp-a31bfa6686eb52506d600a5b77a96fddeb9fb344.tar.xz
to_jcal for new VEvent class.
Diffstat (limited to 'static')
-rw-r--r--static/globals.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/static/globals.js b/static/globals.js
index fd576e26..c414fc5b 100644
--- a/static/globals.js
+++ b/static/globals.js
@@ -6,6 +6,44 @@ class VEventValue {
this.value = value;
this.parameters = parameters;
}
+
+ to_jcal () {
+ let value;
+ let v = this.value;
+ switch (this.type) {
+ case 'binary':
+ /* TOOD */
+ break;
+ case 'date-time':
+ value = v.format("~Y-~m-~dT~H:~M:~S");
+ // TODO TZ
+ break;
+ case 'date':
+ value = v.format("~Y-~m-~d");
+ break;
+ case 'duration':
+ /* TODO */
+ break;
+ case 'period':
+ /* TODO */
+ break;
+ case 'utc-offset':
+ /* TODO */
+ break;
+ case 'recur':
+ value = v.asJcal();
+ break;
+
+ case 'float':
+ case 'integer':
+ case 'text':
+ case 'uri':
+ case 'cal-address':
+ case 'boolean':
+ value = v;
+ }
+ return [this.parameters, this.type, value];
+ }
}
/* maybe ... */
@@ -43,6 +81,16 @@ class VEvent {
register (htmlNode) {
this.registered.push(htmlNode);
}
+
+ to_jcal () {
+ let out_properties = []
+ for (let [key, value] of Object.entries(this.properties)) {
+ let sub = value.to_jcal();
+ sub.unshift(key)
+ out_properties.push(sub);
+ }
+ return ['vevent', out_properties, [/* alarms go here*/]]
+ }
}
function make_vevent_value (value_tag) {