From e9453c73964b46a070d919876f5e7af6654f37ff Mon Sep 17 00:00:00 2001 From: Eddie Date: Wed, 29 May 2024 15:29:42 +0200 Subject: [PATCH] default to utc --- O365/utils/windows_tz.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/O365/utils/windows_tz.py b/O365/utils/windows_tz.py index 1c43f638..cc4f021d 100644 --- a/O365/utils/windows_tz.py +++ b/O365/utils/windows_tz.py @@ -632,8 +632,14 @@ def get_windows_tz(iana_tz: ZoneInfo) -> str: Note: Windows Timezones are SHIT!... no ... really THEY ARE HOLY FUCKING SHIT!. """ - timezone = IANA_TO_WIN.get( - iana_tz.key if isinstance(iana_tz, tzinfo) else iana_tz) + if isinstance(iana_tz, tzinfo): + if hasattr(iana_tz, "key"): + key = iana_tz.key + else: + key = "UTC" + else: + key = iana_tz + timezone= IANA_TO_WIN.get(key) if timezone is None: raise ZoneInfoNotFoundError(f"Can't find Iana timezone: {iana_tz.key}")