max_vevent_rrule_occurrence: TZ fix of RRULE/UNTIL

This commit is contained in:
Peter Bieringer
2026-08-02 16:43:30 +02:00
parent 75a5d9f10e
commit 751189d708

View File

@@ -274,6 +274,9 @@ def check_and_sanitize_items(
raise ValueError("Unsupported FREQ in recurrence rule in %s in object %r: %r" raise ValueError("Unsupported FREQ in recurrence rule in %s in object %r: %r"
% (component.name, component_uid, rrule._freq)) % (component.name, component_uid, rrule._freq))
# RRULE has known FREQ+UNTIL+DTSTART # RRULE has known FREQ+UNTIL+DTSTART
# TZ code taken from vobject/icalendar.py/getrruleset
if rrule._until.tzinfo is None:
rrule._until = rrule._until.replace(tzinfo=dtstart.tzinfo)
if dtstart.tzinfo is not None: if dtstart.tzinfo is not None:
rrule._until = rrule._until.astimezone(dtstart.tzinfo) rrule._until = rrule._until.astimezone(dtstart.tzinfo)
delta = rrule._until - dtstart delta = rrule._until - dtstart