From 671110d1787e6775ac8767bad73b8af728060be6 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Sun, 8 Jan 2023 13:42:19 +0100 Subject: [PATCH] ical: Handle repeting day long events --- modules/ical.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/ical.py b/modules/ical.py index 7a6d79f..1c4cbd7 100644 --- a/modules/ical.py +++ b/modules/ical.py @@ -77,8 +77,13 @@ class IcalModule: elif "SA" in rrule["BYDAY"]: weekday = 5 - start = next_weekday(today, weekday).replace(hour=start.hour, minute=start.minute, second=start.second, microsecond=start.microsecond) - end = next_weekday(today, weekday).replace(hour=end.hour, minute=end.minute, second=end.second, microsecond=end.microsecond) + diff = end - start + + 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 component["DTSTART"] = vDDDTypes(start) component["DTEND"] = vDDDTypes(end)