From e01c8002c3bb758e87c78d4ca345a367ba54dfd8 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Sun, 21 Jun 2026 16:39:08 +0200 Subject: [PATCH 1/2] add PERIOD handling --- vobject/icalendar.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/vobject/icalendar.py b/vobject/icalendar.py index 6ce5502..dd92990 100644 --- a/vobject/icalendar.py +++ b/vobject/icalendar.py @@ -899,13 +899,19 @@ def transformFromNative(obj): obj.value_param = "DATE" obj.value = ",".join([dateToString(val) for val in obj.value]) return obj - # Fixme: handle PERIOD case else: if obj.isNative: obj.isNative = False transformed = [] tzid = None for val in obj.value: + if obj.value_param == "PERIOD": + if type(val[0]) is datetime.datetime and type(val[1]) is datetime.timedelta: + transformed.append(periodToString(val)) + continue + elif type(val[0]) is datetime.datetime and type(val[1]) is datetime.datetime: + transformed.append(dateTimeToString(val[0]) + '/' + dateTimeToString(val[1])) + continue if tzid is None and type(val) is datetime.datetime: tzid = TimezoneComponent.registerTzinfo(val.tzinfo) if tzid is not None: From 172a66706faac88cee4eda1da3dec7f5b091ab9f Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Sun, 21 Jun 2026 16:43:52 +0200 Subject: [PATCH 2/2] make lint happy --- vobject/icalendar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vobject/icalendar.py b/vobject/icalendar.py index dd92990..a82eac0 100644 --- a/vobject/icalendar.py +++ b/vobject/icalendar.py @@ -909,7 +909,7 @@ def transformFromNative(obj): if type(val[0]) is datetime.datetime and type(val[1]) is datetime.timedelta: transformed.append(periodToString(val)) continue - elif type(val[0]) is datetime.datetime and type(val[1]) is datetime.datetime: + if type(val[0]) is datetime.datetime and type(val[1]) is datetime.datetime: transformed.append(dateTimeToString(val[0]) + '/' + dateTimeToString(val[1])) continue if tzid is None and type(val) is datetime.datetime: