diff --git a/CHANGELOG.md b/CHANGELOG.md index 66c307c3..1e38f0b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ _This release is scheduled to be released on 2020-10-01._ ### Fixed - Fix the use of "maxNumberOfDays" in the module "weatherforecast depending on the endpoint (forecast/daily or forecast)". [#2018](https://github.com/MichMich/MagicMirror/issues/2018) +- Fix calendar display. Account for current timezone. [#2068](https://github.com/MichMich/MagicMirror/issues/2068) ## [2.12.0] - 2020-07-01 diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index bba7565d..d18132a6 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -467,6 +467,12 @@ Module.register("calendar", { var calendar = this.calendarData[c]; for (var e in calendar) { var event = JSON.parse(JSON.stringify(calendar[e])); // clone object + + // correct data for the current timezone + var offset = -(new Date().getTimezoneOffset() * 60 * 1000); + event.startDate = event.startDate - offset; + event.endDate = event.endDate - offset; + if (event.endDate < now) { continue; }