diff options
Diffstat (limited to '')
-rw-r--r-- | static/components/date-time-input.ts | 2 | ||||
-rw-r--r-- | static/components/vevent-description.ts | 26 |
2 files changed, 7 insertions, 21 deletions
diff --git a/static/components/date-time-input.ts b/static/components/date-time-input.ts index a6d5df18..005e4190 100644 --- a/static/components/date-time-input.ts +++ b/static/components/date-time-input.ts @@ -67,7 +67,7 @@ class DateTimeInput extends /* HTMLInputElement */ HTMLElement { } set value(date: Date) { - let [d, t] = date.format("~L~Y-~m-~dT~H:~M:~S").split('T'); + let [d, t] = date.format("~L~Y-~m-~dT~H:~M").split('T'); // console.log(d, t); this.date.value = d; this.time.value = t; diff --git a/static/components/vevent-description.ts b/static/components/vevent-description.ts index 4d81d6b3..f0d224be 100644 --- a/static/components/vevent-description.ts +++ b/static/components/vevent-description.ts @@ -2,7 +2,7 @@ export { ComponentDescription } import { VEvent } from '../vevent' import { ComponentVEvent } from './vevent' -import { makeElement } from '../lib' +import { formatters } from '../formatters' /* <vevent-description /> @@ -24,26 +24,12 @@ class ComponentDescription extends ComponentVEvent { for (let el of body.querySelectorAll('[data-property]')) { if (!(el instanceof HTMLElement)) continue; let p = el.dataset.property!; - let d, fmt; + let d; if ((d = data.getProperty(p))) { - switch (p.toLowerCase()) { - case 'categories': - for (let item of d) { - let q = encodeURIComponent( - `(member "${item}" (or (prop event (quote CATEGORIES)) (quote ())))`) - el.appendChild(makeElement('a', { - textContent: item, - href: `/search/?q=${q}`, - })) - } - break; - default: - if ((fmt = el.dataset.fmt)) { - el.textContent = d.format(fmt); - } else { - el.textContent = d; - } - } + let key = p.toLowerCase(); + let f = formatters.get(key); + if (f) f(el, d); + else window.formatters.get('default')!(el, d); } } |