diff --git a/modules/default/calendar/calendarutils.js b/modules/default/calendar/calendarutils.js index 66176bbc..1ac4eb54 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;