1
0
forked from test/crm

refactor: drop pytz usage

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang 2024-12-09 11:50:01 +05:30
parent b9c43df357
commit de1f8da9d1
No known key found for this signature in database
GPG Key ID: 9DCC61E211BF645F

View File

@ -130,14 +130,14 @@ def update_call_status_info(**kwargs):
def get_datetime_from_timestamp(timestamp):
from datetime import datetime
from pytz import timezone
from zoneinfo import ZoneInfo
if not timestamp: return None
datetime_utc_tz_str = timestamp.strftime('%Y-%m-%d %H:%M:%S%z')
datetime_utc_tz = datetime.strptime(datetime_utc_tz_str, '%Y-%m-%d %H:%M:%S%z')
system_timezone = frappe.utils.get_system_timezone()
converted_datetime = datetime_utc_tz.astimezone(timezone(system_timezone))
converted_datetime = datetime_utc_tz.astimezone(ZoneInfo(system_timezone))
return frappe.utils.format_datetime(converted_datetime, 'yyyy-MM-dd HH:mm:ss')
@frappe.whitelist()
@ -179,4 +179,4 @@ def get_lead_or_deal_from_number(call):
if not doc:
doc = find_record(doctype, number)
return doc, doctype
return doc, doctype