Merge pull request #464 from akhilnarang/drop-pytz-usage

refactor: drop pytz usage
This commit is contained in:
Shariq Ansari 2024-12-09 12:35:31 +05:30 committed by GitHub
commit 1e721a69c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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