aboutsummaryrefslogtreecommitdiff
path: root/static/server_connect.js
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-03-02 23:34:14 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2021-03-02 23:34:14 +0100
commitcbe3c46a898822b6ee0f10366e561c6a8055a1b6 (patch)
tree3ceb9ecfb97b0d8a6db6f2c3cc17f59b5c117f63 /static/server_connect.js
parentLook at mapping in vcal types to js types. (diff)
downloadcalp-cbe3c46a898822b6ee0f10366e561c6a8055a1b6.tar.gz
calp-cbe3c46a898822b6ee0f10366e561c6a8055a1b6.tar.xz
Start moving vcal stuff to own class.
Diffstat (limited to '')
-rw-r--r--static/server_connect.js47
1 files changed, 1 insertions, 46 deletions
diff --git a/static/server_connect.js b/static/server_connect.js
index 252d79eb..90bf819d 100644
--- a/static/server_connect.js
+++ b/static/server_connect.js
@@ -21,51 +21,6 @@ async function remove_event (element) {
}
}
-function event_to_jcal (event) {
- let properties = [];
-
- for (let prop of event.properties.ical_properties) {
- let v = event.properties[prop];
- if (v !== undefined) {
-
- let type = 'text';
- let value;
-
- if (v instanceof Array) {
- } else if (v instanceof Date) {
- if (v.isWholeDay) {
- type = 'date';
- value = v.format("~Y-~m-~d");
- } else {
- type = 'date-time';
- /* TODO TZ */
- value = v.format("~Y-~m-~dT~H:~M:~S");
- }
- } else if (v === true || v === false) {
- type = 'boolean';
- value = v;
- } else if (typeof(v) == 'number') {
- /* TODO float or integer */
- type = 'integer';
- value = v;
- } else if (v instanceof RRule) {
- type = 'recur';
- value = v.asJcal();
- }
-
- /* TODO period */
- else {
- /* text types */
- value = v;
- }
-
- properties.push([prop, {}, type, value]);
- }
- }
-
- return ['vevent', properties, [/* alarms go here */]]
-}
-
async function create_event (event) {
// let xml = event.getElementsByTagName("icalendar")[0].outerHTML
@@ -91,7 +46,7 @@ async function create_event (event) {
],
[
/* vtimezone goes here */
- event_to_jcal(event),
+ event.properties.to_jcal()
]
];