ical: Handle event exceptions
This commit is contained in:
parent
671110d178
commit
c67e1bfb8b
@ -1,3 +1,4 @@
|
|||||||
|
from collections.abc import Iterable
|
||||||
from datetime import date, datetime, timedelta, timezone
|
from datetime import date, datetime, timedelta, timezone
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
import hashlib
|
import hashlib
|
||||||
@ -85,6 +86,18 @@ class IcalModule:
|
|||||||
start = next_weekday(todayd, weekday)
|
start = next_weekday(todayd, weekday)
|
||||||
end = start + diff
|
end = start + diff
|
||||||
|
|
||||||
|
exclusions = []
|
||||||
|
if "EXDATE" in component:
|
||||||
|
exdates = component.decoded("EXDATE")
|
||||||
|
if isinstance(exdates, Iterable):
|
||||||
|
for exdate in exdates:
|
||||||
|
exclusions.append(exdate.dts[0].dt)
|
||||||
|
else:
|
||||||
|
exclusions.append(exdates.dts[0].dt)
|
||||||
|
|
||||||
|
while start in exclusions:
|
||||||
|
start += timedelta(days=7)
|
||||||
|
|
||||||
component["DTSTART"] = vDDDTypes(start)
|
component["DTSTART"] = vDDDTypes(start)
|
||||||
component["DTEND"] = vDDDTypes(end)
|
component["DTEND"] = vDDDTypes(end)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user