From dd5938bc684425b69b5dcb4235118d34311673d2 Mon Sep 17 00:00:00 2001 From: Chris Frisina Date: Sat, 1 Oct 2022 01:02:09 -0400 Subject: [PATCH] better return type for historical dates AttributeError: 'NoneType' object has no attribute 'convert' #527 --- pendulum/datetime.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pendulum/datetime.py b/pendulum/datetime.py index bb8b4bc8..66ca5543 100644 --- a/pendulum/datetime.py +++ b/pendulum/datetime.py @@ -243,7 +243,7 @@ def offset_hours(self) -> float | None: @property def timezone(self) -> Timezone | FixedTimezone | None: if not isinstance(self.tzinfo, (Timezone, FixedTimezone)): - return None + return pendulum.timezone(self.tzinfo.key) return self.tzinfo