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

take WordPress time zone into account

This commit is contained in:
Daniel Waxweiler
2021-05-05 10:40:46 +02:00
parent 22c0b22b8e
commit 89145fe9ed
7 changed files with 15 additions and 8 deletions

View File

@@ -4,6 +4,7 @@ import { createAnchorElement } from './html-creator'
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 events = data.events ? data.events.elements : data.group.organizedEvents.elements
const eventsCount = Math.min(maxEventsCount, events.length)
for (let i = 0; i < eventsCount; i++) {
@@ -15,7 +16,7 @@ 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 })
const date = Formatter.formatDate({ locale, start: events[i].beginsOn, end: events[i].endsOn, timeZone })
const textnode = document.createTextNode(date)
li.appendChild(textnode)