fix events with rrule byweekday

This commit is contained in:
Sam Detweiler 2022-09-05 14:13:46 -05:00
parent ca906c4b36
commit 032f7ac299

View File

@ -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
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)) {
// 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:
// 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)) {
// 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;