From 8ce37d53cd8a452c3098b58be7126861b6d8d180 Mon Sep 17 00:00:00 2001 From: sam detweiler Date: Tue, 1 Sep 2020 14:04:35 +0100 Subject: [PATCH 1/6] fix recurring full date events --- modules/default/calendar/calendarfetcher.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/default/calendar/calendarfetcher.js b/modules/default/calendar/calendarfetcher.js index 4a6fb0e6..f320fbcd 100644 --- a/modules/default/calendar/calendarfetcher.js +++ b/modules/default/calendar/calendarfetcher.js @@ -184,8 +184,17 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumNu // For recurring events, get the set of start dates that fall within the range // of dates we're looking for. // kblankenship1989 - to fix issue #1798, converting all dates to locale time first, then converting back to UTC time - const pastLocal = pastMoment.subtract(past.getTimezoneOffset(), "minutes").toDate(); - const futureLocal = futureMoment.subtract(future.getTimezoneOffset(), "minutes").toDate(); + let pastLocal = 0 + let futureLocal = 0 + if(isFullDayEvent(event)){ + // if full day event, only use the date part of the ranges + pastLocal = pastMoment.toDate(); + futureLocal = futureMoment.toDate() + } + else { + pastLocal = pastMoment.subtract(past.getTimezoneOffset(), "minutes").toDate(); + futureLocal = futureMoment.subtract(future.getTimezoneOffset(), "minutes").toDate(); + } const datesLocal = rule.between(pastLocal, futureLocal, true, limitFunction); const dates = datesLocal.map(function (dateLocal) { return moment(dateLocal).add(dateLocal.getTimezoneOffset(), "minutes").toDate(); @@ -217,6 +226,7 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumNu const dateKey = date.toISOString().substring(0, 10); let curEvent = event; let showRecurrence = true; + let duration = 0; startDate = moment(date); From 11fbbd49f3a6178c255e38426d2ef14d2c25000f Mon Sep 17 00:00:00 2001 From: sam detweiler Date: Tue, 1 Sep 2020 14:10:25 +0100 Subject: [PATCH 2/6] add changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b4ee497..a6d1247a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/). ❤️ **Donate:** Enjoying MagicMirror²? [Please consider a donation!](https://magicmirror.builders/donate) With your help we can continue to improve the MagicMirror² +### fixed + +- 2110, 2111, 2118 recurring full day events should not use timezone adjustment. just compare month/day ## [2.12.0] - 2020-07-01 From c3382274a290b0fddebab59b92a99227f99c70f5 Mon Sep 17 00:00:00 2001 From: sam detweiler Date: Tue, 1 Sep 2020 14:40:07 +0100 Subject: [PATCH 3/6] remove old master branch code --- modules/default/calendar/calendarfetcher.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/default/calendar/calendarfetcher.js b/modules/default/calendar/calendarfetcher.js index f320fbcd..e6e13916 100644 --- a/modules/default/calendar/calendarfetcher.js +++ b/modules/default/calendar/calendarfetcher.js @@ -195,10 +195,7 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumNu pastLocal = pastMoment.subtract(past.getTimezoneOffset(), "minutes").toDate(); futureLocal = futureMoment.subtract(future.getTimezoneOffset(), "minutes").toDate(); } - const datesLocal = rule.between(pastLocal, futureLocal, true, limitFunction); - const dates = datesLocal.map(function (dateLocal) { - return moment(dateLocal).add(dateLocal.getTimezoneOffset(), "minutes").toDate(); - }); + const dates = rule.between(pastLocal, futureLocal, true, limitFunction); // The "dates" array contains the set of dates within our desired date range range that are valid // for the recurrence rule. *However*, it's possible for us to have a specific recurrence that From 7bec84f767df2c70c60ccb5953a122d78cf8646f Mon Sep 17 00:00:00 2001 From: sam detweiler Date: Tue, 1 Sep 2020 21:00:14 +0100 Subject: [PATCH 4/6] fix formatting, prettier did not run --- modules/default/calendar/calendarfetcher.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/default/calendar/calendarfetcher.js b/modules/default/calendar/calendarfetcher.js index 0f8cfb24..3c0c3cd2 100644 --- a/modules/default/calendar/calendarfetcher.js +++ b/modules/default/calendar/calendarfetcher.js @@ -202,13 +202,13 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn // For recurring events, get the set of start dates that fall within the range // of dates we're looking for. // kblankenship1989 - to fix issue #1798, converting all dates to locale time first, then converting back to UTC time - let pastLocal = 0 - let futureLocal = 0 - if(isFullDayEvent(event)){ + let pastLocal = 0; + let futureLocal = 0; + if( isFullDayEvent(event)) { // if full day event, only use the date part of the ranges pastLocal = pastMoment.toDate(); - futureLocal = futureMoment.toDate() - } + futureLocal = futureMoment.toDate(); + } else { pastLocal = pastMoment.subtract(past.getTimezoneOffset(), "minutes").toDate(); futureLocal = futureMoment.subtract(future.getTimezoneOffset(), "minutes").toDate(); From f09b89f97527d538e4ef5eeb178ca7d7553ed6d0 Mon Sep 17 00:00:00 2001 From: Sam Detweiler Date: Tue, 1 Sep 2020 15:13:42 -0500 Subject: [PATCH 5/6] fix , prettier not run --- modules/default/calendar/calendarfetcher.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/default/calendar/calendarfetcher.js b/modules/default/calendar/calendarfetcher.js index 3c0c3cd2..a67dc99b 100644 --- a/modules/default/calendar/calendarfetcher.js +++ b/modules/default/calendar/calendarfetcher.js @@ -203,13 +203,12 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn // of dates we're looking for. // kblankenship1989 - to fix issue #1798, converting all dates to locale time first, then converting back to UTC time let pastLocal = 0; - let futureLocal = 0; - if( isFullDayEvent(event)) { + let futureLocal = 0; + if (isFullDayEvent(event)) { // if full day event, only use the date part of the ranges pastLocal = pastMoment.toDate(); - futureLocal = futureMoment.toDate(); - } - else { + futureLocal = futureMoment.toDate(); + } else { pastLocal = pastMoment.subtract(past.getTimezoneOffset(), "minutes").toDate(); futureLocal = futureMoment.subtract(future.getTimezoneOffset(), "minutes").toDate(); } From 1a210278509680ecf8df23b56894d17f9fdc6ef7 Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Wed, 2 Sep 2020 09:03:46 +0200 Subject: [PATCH 6/6] Fix Prettier issues. --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b971805a..7756977a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/). ❤️ **Donate:** Enjoying MagicMirror²? [Please consider a donation!](https://magicmirror.builders/donate) With your help we can continue to improve the MagicMirror² -### fixed -- 2110, 2111, 2118 recurring full day events should not use timezone adjustment. just compare month/day +### fixed + +- 2110, 2111, 2118 recurring full day events should not use timezone adjustment. just compare month/day ## [2.13.0] - Unreleased (Develop Branch - Please add your contributions to this release.)