diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-07-11 00:14:33 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-07-11 00:14:33 +0200 |
commit | 217578c6731d1661953a628f238858dd742114b5 (patch) | |
tree | 31d46512e54eae9f9f7ca29db1619375f9889119 /static/script.js | |
parent | Javascript icalendar format of datetime. (diff) | |
download | calp-217578c6731d1661953a628f238858dd742114b5.tar.gz calp-217578c6731d1661953a628f238858dd742114b5.tar.xz |
Switch on type instead of field name...
Diffstat (limited to 'static/script.js')
-rw-r--r-- | static/script.js | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/static/script.js b/static/script.js index 98311931..008e01bb 100644 --- a/static/script.js +++ b/static/script.js @@ -346,14 +346,11 @@ window.onload = function () { lst.push([s, f]); } for (let s of el.querySelectorAll(field + " > :not(parameters)")) { - switch (field) { - case 'dtstart': - if (s.tagName === 'date') { - lst.push([s, (s, v) => s.innerHTML = v.format("%Y-%m-%d")]); - } else { - lst.push([s, (s, v) => s.innerHTML = v.format("%Y-%m-%dT%H:%M:%S")]); - } - break; + switch (s.tagName) { + case 'date': + lst.push([s, (s, v) => s.innerHTML = v.format("%Y-%m-%d")]); break; + case 'date-time': + lst.push([s, (s, v) => s.innerHTML = v.format("%Y-%m-%dT%H:%M:%S")]); break; default: lst.push([s, (s, v) => s.innerHTML = v]); } |