Fixed timezone awareness adder

This commit is contained in:
Maximilian Giller 2019-07-07 18:16:52 +02:00
parent 016d022303
commit 6bda730c61

View file

@ -135,10 +135,10 @@ class CalendarInterface (DataSourceInterface):
until_index = rrule.index("UNTIL")
tz_index = until_index + len(until_template)
if tz_index < 0 or tz_index >= len(rrule):
return rrule
if rrule[tz_index] is "T":
if until_index < 0 or (tz_index < len(rrule) and rrule[tz_index] is "T"):
return rrule
if tz_index == len(rrule):
return rrule + timezone_str
else:
return rrule[:tz_index] + timezone_str + rrule[tz_index:]