kopia lustrzana https://github.com/jazzband/icalevents
commit
98ed17d084
|
@ -6,6 +6,7 @@ from random import randint
|
|||
from datetime import datetime, timedelta, date
|
||||
|
||||
from icalendar import Calendar
|
||||
from icalendar.prop import vDDDLists
|
||||
from pytz import utc
|
||||
|
||||
|
||||
|
@ -326,8 +327,27 @@ def create_recurring_events(start, end, component):
|
|||
unfolded.append(current)
|
||||
else:
|
||||
break
|
||||
|
||||
reduced_range = in_range(unfolded, start, end)
|
||||
|
||||
exceptions = extract_exdates(component)
|
||||
reduced_exceptions = [ev for ev in reduced_range if ev.start not in exceptions]
|
||||
|
||||
return in_range(unfolded, start, end)
|
||||
return reduced_exceptions
|
||||
|
||||
|
||||
def extract_exdates(component):
|
||||
dates = []
|
||||
|
||||
exd_prop = component.get('exdate')
|
||||
if exd_prop:
|
||||
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
|
||||
|
||||
|
||||
def generate_day_deltas_by_weekday(by_day):
|
||||
|
|
Ładowanie…
Reference in New Issue