1
0
mirror of https://github.com/dwaxweiler/connector-mobilizon synced 2025-06-05 21:59:25 +02:00

optionally display the current offset as short name after the time via the general plugin settings

This commit is contained in:
Daniel Waxweiler
2021-05-23 15:37:29 +02:00
parent 0b3c998e56
commit 7795ccc36a
11 changed files with 83 additions and 4 deletions

View File

@@ -5,6 +5,7 @@ export function displayEvents({ data, document, list }) {
const locale = list.getAttribute('data-locale')
const maxEventsCount = list.getAttribute('data-maximum')
const timeZone = list.getAttribute('data-time-zone')
const isShortOffsetNameShown = list.hasAttribute('data-is-short-offset-name-shown')
const events = data.events ? data.events.elements : data.group.organizedEvents.elements
const eventsCount = Math.min(maxEventsCount, events.length)
for (let i = 0; i < eventsCount; i++) {
@@ -16,7 +17,13 @@ export function displayEvents({ data, document, list }) {
const br = document.createElement('br')
li.appendChild(br)
const date = Formatter.formatDate({ locale, start: events[i].beginsOn, end: events[i].endsOn, timeZone })
const date = Formatter.formatDate({
locale,
start: events[i].beginsOn,
end: events[i].endsOn,
timeZone,
isShortOffsetNameShown,
})
const textnode = document.createTextNode(date)
li.appendChild(textnode)