Verified Commit f539713c authored by Sandro Lutz's avatar Sandro Lutz
Browse files

Fix time zone issues

parent 92bca127
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
} }
} }
.content { .event-content {
grid-area: content; grid-area: content;
padding: 1em; padding: 1em;
......
...@@ -101,8 +101,6 @@ export default class EventDetails { ...@@ -101,8 +101,6 @@ export default class EventDetails {
const registerStart = new Date(this.event.time_register_start); const registerStart = new Date(this.event.time_register_start);
const registerEnd = new Date(this.event.time_register_end); const registerEnd = new Date(this.event.time_register_end);
console.log(this.event.time_register_start);
if (this.event.time_register_start === null) { if (this.event.time_register_start === null) {
eventSignupForm = m('div', m('p', i18n('events.registration.none'))); eventSignupForm = m('div', m('p', i18n('events.registration.none')));
} else if (registerStart <= now) { } else if (registerStart <= now) {
...@@ -153,7 +151,6 @@ export default class EventDetails { ...@@ -153,7 +151,6 @@ export default class EventDetails {
m( m(
'p.colored', 'p.colored',
registerStart.toLocaleString(currentLocale(), { registerStart.toLocaleString(currentLocale(), {
timeZone: 'UTC',
weekday: 'long', weekday: 'long',
day: '2-digit', day: '2-digit',
month: '2-digit', month: '2-digit',
......
...@@ -171,6 +171,8 @@ export default class EventList extends FilteredListPage { ...@@ -171,6 +171,8 @@ export default class EventList extends FilteredListPage {
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
_renderItem(event, list, selectedId) { _renderItem(event, list, selectedId) {
if (!event) return m('');
const animationDuration = 300; // in ms const animationDuration = 300; // in ms
const imageurl = event.img_thumbnail ? `${apiUrl}${event.img_thumbnail.file}` : logos.amivWheel; const imageurl = event.img_thumbnail ? `${apiUrl}${event.img_thumbnail.file}` : logos.amivWheel;
const properties = [ const properties = [
...@@ -199,7 +201,7 @@ export default class EventList extends FilteredListPage { ...@@ -199,7 +201,7 @@ export default class EventList extends FilteredListPage {
header: () => header: () =>
m('div.event-header', [ m('div.event-header', [
m('div.image.ratio-1to1', m('img', { src: imageurl, alt: event.getTitle() })), m('div.image.ratio-1to1', m('img', { src: imageurl, alt: event.getTitle() })),
m('div.content', [ m('div.event-content', [
m('h2.title', event.getTitle()), m('h2.title', event.getTitle()),
m('div.catchphrase', event.getCatchphrase()), m('div.catchphrase', event.getCatchphrase()),
m('div.date', this.constructor._renderEventTime(event.time_start, event.time_end)), m('div.date', this.constructor._renderEventTime(event.time_start, event.time_end)),
...@@ -257,15 +259,14 @@ export default class EventList extends FilteredListPage { ...@@ -257,15 +259,14 @@ export default class EventList extends FilteredListPage {
const date_end = new Date(time_end); const date_end = new Date(time_end);
if ( if (
date_start.getUTCDate() === date_end.getUTCDate() || date_start.getDate() === date_end.getDate() ||
(date_start.getUTCDate() === date_end.getUTCDate() - 1 && (date_start.getDate() === date_end.getDate() - 1 &&
date_start.getUTCHours() > date_end.getUTCHours()) date_start.getHours() > date_end.getHours())
) { ) {
return [ return [
m( m(
'span', 'span',
date_start.toLocaleString(currentLocale(), { date_start.toLocaleString(currentLocale(), {
timeZone: 'UTC',
weekday: 'long', weekday: 'long',
day: '2-digit', day: '2-digit',
month: '2-digit', month: '2-digit',
...@@ -278,9 +279,9 @@ export default class EventList extends FilteredListPage { ...@@ -278,9 +279,9 @@ export default class EventList extends FilteredListPage {
m( m(
'span', 'span',
date_end.toLocaleString(currentLocale(), { date_end.toLocaleString(currentLocale(), {
timeZone: 'UTC',
hour: '2-digit', hour: '2-digit',
minute: '2-digit', minute: '2-digit',
timeZoneName: 'short',
}) })
), ),
]; ];
...@@ -290,7 +291,6 @@ export default class EventList extends FilteredListPage { ...@@ -290,7 +291,6 @@ export default class EventList extends FilteredListPage {
m( m(
'span', 'span',
date_start.toLocaleString(currentLocale(), { date_start.toLocaleString(currentLocale(), {
timeZone: 'UTC',
weekday: 'long', weekday: 'long',
day: '2-digit', day: '2-digit',
month: '2-digit', month: '2-digit',
...@@ -303,13 +303,13 @@ export default class EventList extends FilteredListPage { ...@@ -303,13 +303,13 @@ export default class EventList extends FilteredListPage {
m( m(
'span', 'span',
date_end.toLocaleString(currentLocale(), { date_end.toLocaleString(currentLocale(), {
timeZone: 'UTC',
weekday: 'long', weekday: 'long',
day: '2-digit', day: '2-digit',
month: '2-digit', month: '2-digit',
year: '2-digit', year: '2-digit',
hour: '2-digit', hour: '2-digit',
minute: '2-digit', minute: '2-digit',
timeZoneName: 'short',
}) })
), ),
]; ];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment