Compare commits
2 Commits
8f227ff099
...
c67e1bfb8b
Author | SHA1 | Date | |
---|---|---|---|
c67e1bfb8b | |||
671110d178 |
@ -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
|
||||||
@ -77,8 +78,25 @@ class IcalModule:
|
|||||||
elif "SA" in rrule["BYDAY"]:
|
elif "SA" in rrule["BYDAY"]:
|
||||||
weekday = 5
|
weekday = 5
|
||||||
|
|
||||||
start = next_weekday(today, weekday).replace(hour=start.hour, minute=start.minute, second=start.second, microsecond=start.microsecond)
|
diff = end - start
|
||||||
end = next_weekday(today, weekday).replace(hour=end.hour, minute=end.minute, second=end.second, microsecond=end.microsecond)
|
|
||||||
|
if isinstance(start, datetime):
|
||||||
|
start = next_weekday(today, weekday).replace(hour=start.hour, minute=start.minute, second=start.second, microsecond=start.microsecond)
|
||||||
|
else:
|
||||||
|
start = next_weekday(todayd, weekday)
|
||||||
|
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…
x
Reference in New Issue
Block a user