From 56cbfbf8b7f049209bca92fbe7c472be0d55056c Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Mon, 9 Dec 2024 15:28:04 +0530 Subject: [PATCH] fix: replace tzinfo --- mail_client/utils/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mail_client/utils/__init__.py b/mail_client/utils/__init__.py index 2f09dbe7..bcaae6d2 100644 --- a/mail_client/utils/__init__.py +++ b/mail_client/utils/__init__.py @@ -104,7 +104,7 @@ def add_or_update_tzinfo(date_time: datetime | str, timezone: str | None = None) target_tz = ZoneInfo(timezone or get_system_timezone()) if date_time.tzinfo is None: - date_time = target_tz.localize(date_time) + date_time = date_time.replace(tzinfo=target_tz) else: date_time = date_time.astimezone(target_tz)