From 4cf18d37bd0568fa3347e8bda2bbd05f0a015d44 Mon Sep 17 00:00:00 2001 From: Akhil Narang Date: Tue, 10 Dec 2024 16:12:01 +0530 Subject: [PATCH] fix(convert_utc_to_timezone): set UTC if tzinfo undefined Signed-off-by: Akhil Narang --- frappe/utils/data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/utils/data.py b/frappe/utils/data.py index 8a00b336f1..440d8b8211 100644 --- a/frappe/utils/data.py +++ b/frappe/utils/data.py @@ -372,7 +372,7 @@ def get_system_timezone() -> str: def convert_utc_to_timezone(utc_timestamp: datetime.datetime, time_zone: str) -> datetime.datetime: if utc_timestamp.tzinfo is None: - utc_timestamp = utc_timestamp.replace(tzinfo=ZoneInfo(time_zone)) + utc_timestamp = utc_timestamp.replace(tzinfo=ZoneInfo("UTC")) try: return utc_timestamp.astimezone(ZoneInfo(time_zone))