From 032f7ac29937201ab40b3361aa68943781760a06 Mon Sep 17 00:00:00 2001 From: Sam Detweiler Date: Mon, 5 Sep 2022 14:13:46 -0500 Subject: [PATCH 1/4] fix events with rrule byweekday --- modules/default/calendar/calendarutils.js | 32 ++++++++++++++++------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/modules/default/calendar/calendarutils.js b/modules/default/calendar/calendarutils.js index 66176bbcd6..1ac4eb5446 100644 --- a/modules/default/calendar/calendarutils.js +++ b/modules/default/calendar/calendarutils.js @@ -333,9 +333,12 @@ const CalendarUtils = { // If the offset is negative (east of GMT), where the problem is if (dateoffset < 0) { if (dh < Math.abs(dateoffset / 60)) { + // if the rrule byweekday WAS explicitly set , correct it // reduce the time by the offset - // Apply the correction to the date/time to get it UTC relative - date = new Date(date.getTime() - Math.abs(24 * 60) * 60000); + if(curEvent.rrule.origOptions.byweekday !== undefined){ + // Apply the correction to the date/time to get it UTC relative + date = new Date(date.getTime() - Math.abs(24 * 60) * 60000); + } // the duration was calculated way back at the top before we could correct the start time.. // fix it for this event entry //duration = 24 * 60 * 60 * 1000; @@ -346,8 +349,13 @@ const CalendarUtils = { //if (event.start.tz === moment.tz.guess()) { // if the date hour is less than the offset if (24 - dh <= Math.abs(dateoffset / 60)) { - // apply the correction to the date/time back to right day - date = new Date(date.getTime() + Math.abs(24 * 60) * 60000); + // if the rrule byweekday WAS explicitly set , correct it + if(curEvent.rrule.origOptions.byweekday !== undefined){ + if(curEvent.rrule.origOptions.byweekday !== undefined){ + // apply the correction to the date/time back to right day + date = new Date(date.getTime() + Math.abs(24 * 60) * 60000); + } + } // the duration was calculated way back at the top before we could correct the start time.. // fix it for this event entry //duration = 24 * 60 * 60 * 1000; @@ -361,9 +369,12 @@ const CalendarUtils = { if (dateoffset < 0) { // if the date hour is less than the offset if (dh <= Math.abs(dateoffset / 60)) { - // Reduce the time by the offset: - // Apply the correction to the date/time to get it UTC relative - date = new Date(date.getTime() - Math.abs(24 * 60) * 60000); + // if the rrule byweekday WAS explicitly set , correct it + if(curEvent.rrule.origOptions.byweekday !== undefined){ + // Reduce the time by t: + // Apply the correction to the date/time to get it UTC relative + date = new Date(date.getTime() - Math.abs(24 * 60) * 60000); + } // the duration was calculated way back at the top before we could correct the start time.. // fix it for this event entry //duration = 24 * 60 * 60 * 1000; @@ -374,8 +385,11 @@ const CalendarUtils = { //if (event.start.tz === moment.tz.guess()) { // if the date hour is less than the offset if (24 - dh <= Math.abs(dateoffset / 60)) { - // apply the correction to the date/time back to right day - date = new Date(date.getTime() + Math.abs(24 * 60) * 60000); + // if the rrule byweekday WAS explicitly set , correct it + if(curEvent.rrule.origOptions.byweekday !== undefined){ + // apply the correction to the date/time back to right day + date = new Date(date.getTime() + Math.abs(24 * 60) * 60000); + } // the duration was calculated way back at the top before we could correct the start time.. // fix it for this event entry //duration = 24 * 60 * 60 * 1000; From 0a35505e8da2b355ee10063b0c429d74779abf09 Mon Sep 17 00:00:00 2001 From: Sam Detweiler Date: Mon, 5 Sep 2022 14:52:53 -0500 Subject: [PATCH 2/4] fix repeating calendar events without byday adjusted incorrectly --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cd76213ee..2fc7cfa9e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ _This release is scheduled to be released on 2022-10-01._ - Respect rss ttl provided by newsfeed (#2883). - Fix multi day calendar events always presented as "(1/X)" instead of the amount of days the event has progressed. - Fix weatherbit provider to use type config value instead of endpoint +- Fix calendar events which DO NOT specify rrule byday adjusted incorrectly #2885 ## [2.20.0] - 2022-07-02 From 174da38cc8f2958201a58ed0bc567c6ccfc54dd4 Mon Sep 17 00:00:00 2001 From: Sam Detweiler Date: Mon, 5 Sep 2022 15:02:16 -0500 Subject: [PATCH 3/4] run prettier --- CHANGELOG.md | 2 +- modules/default/calendar/calendarutils.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fc7cfa9e4..873311aae3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,7 @@ _This release is scheduled to be released on 2022-10-01._ - Respect rss ttl provided by newsfeed (#2883). - Fix multi day calendar events always presented as "(1/X)" instead of the amount of days the event has progressed. - Fix weatherbit provider to use type config value instead of endpoint -- Fix calendar events which DO NOT specify rrule byday adjusted incorrectly #2885 +- Fix calendar events which DO NOT specify rrule byday adjusted incorrectly #2885 ## [2.20.0] - 2022-07-02 diff --git a/modules/default/calendar/calendarutils.js b/modules/default/calendar/calendarutils.js index 1ac4eb5446..dc4b5c92fc 100644 --- a/modules/default/calendar/calendarutils.js +++ b/modules/default/calendar/calendarutils.js @@ -333,9 +333,9 @@ const CalendarUtils = { // If the offset is negative (east of GMT), where the problem is if (dateoffset < 0) { if (dh < Math.abs(dateoffset / 60)) { - // if the rrule byweekday WAS explicitly set , correct it + // if the rrule byweekday WAS explicitly set , correct it // reduce the time by the offset - if(curEvent.rrule.origOptions.byweekday !== undefined){ + if (curEvent.rrule.origOptions.byweekday !== undefined) { // Apply the correction to the date/time to get it UTC relative date = new Date(date.getTime() - Math.abs(24 * 60) * 60000); } @@ -350,8 +350,8 @@ const CalendarUtils = { // if the date hour is less than the offset if (24 - dh <= Math.abs(dateoffset / 60)) { // if the rrule byweekday WAS explicitly set , correct it - if(curEvent.rrule.origOptions.byweekday !== undefined){ - if(curEvent.rrule.origOptions.byweekday !== undefined){ + if (curEvent.rrule.origOptions.byweekday !== undefined) { + if (curEvent.rrule.origOptions.byweekday !== undefined) { // apply the correction to the date/time back to right day date = new Date(date.getTime() + Math.abs(24 * 60) * 60000); } @@ -370,7 +370,7 @@ const CalendarUtils = { // if the date hour is less than the offset if (dh <= Math.abs(dateoffset / 60)) { // if the rrule byweekday WAS explicitly set , correct it - if(curEvent.rrule.origOptions.byweekday !== undefined){ + if (curEvent.rrule.origOptions.byweekday !== undefined) { // Reduce the time by t: // Apply the correction to the date/time to get it UTC relative date = new Date(date.getTime() - Math.abs(24 * 60) * 60000); @@ -386,7 +386,7 @@ const CalendarUtils = { // if the date hour is less than the offset if (24 - dh <= Math.abs(dateoffset / 60)) { // if the rrule byweekday WAS explicitly set , correct it - if(curEvent.rrule.origOptions.byweekday !== undefined){ + if (curEvent.rrule.origOptions.byweekday !== undefined) { // apply the correction to the date/time back to right day date = new Date(date.getTime() + Math.abs(24 * 60) * 60000); } From 11d17dd2c048d022c6735afef1bbdd4fdcbefe5d Mon Sep 17 00:00:00 2001 From: Sam Detweiler Date: Tue, 6 Sep 2022 13:29:08 -0500 Subject: [PATCH 4/4] fix typo, duplcate line --- modules/default/calendar/calendarutils.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/default/calendar/calendarutils.js b/modules/default/calendar/calendarutils.js index dc4b5c92fc..20c8ff0a25 100644 --- a/modules/default/calendar/calendarutils.js +++ b/modules/default/calendar/calendarutils.js @@ -351,10 +351,8 @@ const CalendarUtils = { if (24 - dh <= Math.abs(dateoffset / 60)) { // if the rrule byweekday WAS explicitly set , correct it if (curEvent.rrule.origOptions.byweekday !== undefined) { - if (curEvent.rrule.origOptions.byweekday !== undefined) { - // apply the correction to the date/time back to right day - date = new Date(date.getTime() + Math.abs(24 * 60) * 60000); - } + // apply the correction to the date/time back to right day + date = new Date(date.getTime() + Math.abs(24 * 60) * 60000); } // the duration was calculated way back at the top before we could correct the start time.. // fix it for this event entry