diff --git a/vobject/icalendar.py b/vobject/icalendar.py index 5640a77..52ff94b 100644 --- a/vobject/icalendar.py +++ b/vobject/icalendar.py @@ -335,6 +335,10 @@ def pickTzid(tzinfo, allowUTC=False): if tzinfo is None or (not allowUTC and tzinfo_eq(tzinfo, utc)): return None + # Try a zoneinfo (CPython 3.9+) first. + if hasattr(tzinfo, 'key'): + return toUnicode(tzinfo.key) + # Try pytz tzid key if hasattr(tzinfo, 'tzid'): return toUnicode(tzinfo.tzid)