Merge pull request #269 from tfux/ics_import

fix(calendar): fallback to tz found in ics (fixes #4943)
pull/270/head
Extra Fu 2020-02-05 11:34:58 -05:00 committed by GitHub
commit dda13e602b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 4 deletions

View File

@ -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;

View File

@ -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])
{

View File

@ -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];

View File

@ -31,7 +31,7 @@
- (BOOL) isStillRelevant;
- (NSTimeInterval) occurenceInterval;
- (void) updateRecurrenceRulesUntilDate: (NSCalendarDate *) previousEndDate;
- (iCalTimeZone *) adjustInContext: (WOContext *) context;
- (iCalTimeZone *) adjustInContext: (WOContext *) context withTimezones: (NSDictionary *) timezones;
@end

View File

@ -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
{