From b08da0f6bd153b4928e7f059f71404ea8bd8010e Mon Sep 17 00:00:00 2001 From: Akhil Narang Date: Tue, 28 Jan 2025 11:12:56 +0530 Subject: [PATCH] fix(book_appointment): stop trying to use pytz api with zoneinfo Signed-off-by: Akhil Narang --- erpnext/www/book_appointment/index.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/www/book_appointment/index.py b/erpnext/www/book_appointment/index.py index fe75aea33cf..23425454c29 100644 --- a/erpnext/www/book_appointment/index.py +++ b/erpnext/www/book_appointment/index.py @@ -125,15 +125,15 @@ def filter_timeslots(date, timeslots): def convert_to_guest_timezone(guest_tz, datetimeobject): guest_tz = zoneinfo.ZoneInfo(guest_tz) local_timezone = zoneinfo.ZoneInfo(get_system_timezone()) - datetimeobject = local_timezone.localize(datetimeobject) + datetimeobject = datetimeobject.replace(tzinfo=local_timezone) datetimeobject = datetimeobject.astimezone(guest_tz) return datetimeobject def convert_to_system_timezone(guest_tz, datetimeobject): - guest_tz = zoneinfo.ZoneInfo.timezone(guest_tz) - datetimeobject = guest_tz.localize(datetimeobject) - system_tz = zoneinfo.ZoneInfo.timezone(get_system_timezone()) + guest_tz = zoneinfo.ZoneInfo(guest_tz) + datetimeobject = datetimeobject.replace(tzinfo=guest_tz) + system_tz = zoneinfo.ZoneInfo(get_system_timezone()) datetimeobject = datetimeobject.astimezone(system_tz) return datetimeobject