From d1b0a927a6bb091f06decf19be52c86bffe7c837 Mon Sep 17 00:00:00 2001 From: jaca Date: Sat, 29 Oct 2022 17:08:18 +0200 Subject: [PATCH] skip VALUE properties on DTSTART when using the default value #318 --- src/icalendar/prop.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/icalendar/prop.py b/src/icalendar/prop.py index 36d2b948..1443c7b0 100644 --- a/src/icalendar/prop.py +++ b/src/icalendar/prop.py @@ -292,7 +292,7 @@ def __init__(self, dt): raise ValueError('You must use datetime, date, timedelta, ' 'time or tuple (for periods)') if isinstance(dt, datetime): - self.params = Parameters({'value': 'DATE-TIME'}) + self.params = Parameters() elif isinstance(dt, date): self.params = Parameters({'value': 'DATE'}) elif isinstance(dt, time): @@ -300,12 +300,10 @@ def __init__(self, dt): elif isinstance(dt, tuple): self.params = Parameters({'value': 'PERIOD'}) - if (isinstance(dt, datetime) or isinstance(dt, time))\ - and getattr(dt, 'tzinfo', False): - tzinfo = dt.tzinfo - tzid = tzid_from_dt(dt) - if tzid != 'UTC': - self.params.update({'TZID': tzid}) + tzid = tzid_from_dt(dt) if isinstance(dt, (datetime, time)) else None + if not tzid is None and tzid != 'UTC': + self.params.update({'TZID': tzid}) + self.dt = dt def to_ical(self):