diff --git a/SOPE/NGCards/iCalTimeZonePeriod.m b/SOPE/NGCards/iCalTimeZonePeriod.m index d21dfe111..378807453 100644 --- a/SOPE/NGCards/iCalTimeZonePeriod.m +++ b/SOPE/NGCards/iCalTimeZonePeriod.m @@ -300,7 +300,7 @@ = [(iCalDateTime *) [self uniqueChildWithTag: @"dtstart"] dateTime]; else if ([rrule untilDate] == nil || [refDate compare: [rrule untilDate]] == NSOrderedAscending) tmpDate = [self _occurrenceForDate: refDate byRRule: rrule]; - else if ([refDate compare: [rrule untilDate]] == NSOrderedDescending) + else if ([[self _occurrenceForDate: refDate byRRule: rrule] compare: [rrule untilDate] ] == NSOrderedAscending) tmpDate = [rrule untilDate]; return tmpDate; diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index 61e4f071a..6591eb3a0 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -3441,7 +3441,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir if ([element isKindOfClass: iCalEventK]) { event = (iCalEvent *)element; - timezone = [event adjustInContext: self->context]; + timezone = [event adjustInContext: self->context withTimezones: timezones]; if ([event recurrenceId]) { diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index 0143992fb..b6367b9e0 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -1943,7 +1943,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent { event = [allEvents objectAtIndex: i]; - tz = [event adjustInContext: context]; + tz = [event adjustInContext: context withTimezones: nil]; if (tz) [rqCalendar addTimeZone: tz]; diff --git a/SoObjects/Appointments/iCalEvent+SOGo.h b/SoObjects/Appointments/iCalEvent+SOGo.h index ea4682d82..cfa351d1b 100644 --- a/SoObjects/Appointments/iCalEvent+SOGo.h +++ b/SoObjects/Appointments/iCalEvent+SOGo.h @@ -31,7 +31,7 @@ - (BOOL) isStillRelevant; - (NSTimeInterval) occurenceInterval; - (void) updateRecurrenceRulesUntilDate: (NSCalendarDate *) previousEndDate; -- (iCalTimeZone *) adjustInContext: (WOContext *) context; +- (iCalTimeZone *) adjustInContext: (WOContext *) context withTimezones: (NSDictionary *) timezones; @end diff --git a/SoObjects/Appointments/iCalEvent+SOGo.m b/SoObjects/Appointments/iCalEvent+SOGo.m index 005dd2a36..1710a91c7 100644 --- a/SoObjects/Appointments/iCalEvent+SOGo.m +++ b/SoObjects/Appointments/iCalEvent+SOGo.m @@ -446,6 +446,7 @@ } - (iCalTimeZone *) adjustInContext: (WOContext *) context + withTimezones: (NSDictionary *) timezones { iCalDateTime *startDate, *endDate; iCalTimeZone *timezone; @@ -484,6 +485,9 @@ if ([timezoneId length]) { timezone = [iCalTimeZone timeZoneForName: timezoneId]; + // Fallback to tz (VTIMEZONE) found in the ics. + if (!timezone) + timezone = [timezones valueForKey: timezoneId]; } else {