Skip to content

Commit

Permalink
Strip exception dates
Browse files Browse the repository at this point in the history
Don't fail for single exception dates.
  • Loading branch information
dlichtistw committed Sep 16, 2018
1 parent adc1fcd commit 914e872
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions icalevents/icalparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from datetime import datetime, timedelta, date

from icalendar import Calendar
from icalendar.prop import vDDDLists
from pytz import utc


Expand Down Expand Up @@ -340,8 +341,11 @@ def extract_exdates(component):

exd_prop = component.get('exdate')
if exd_prop:
for exd_list in exd_prop:
dates.extend(exd.dt for exd in exd_list.dts if (exd))
if isinstance(exd_prop, list):
for exd_list in exd_prop:
dates.extend(exd.dt for exd in exd_list.dts)
elif isinstance(exd_prop, vDDDLists):
dates.extend(exd.dt for exd in exd_prop.dts)

return dates

Expand Down

0 comments on commit 914e872

Please sign in to comment.