From 83100c9c847ef000c8e071ccdab4c1cf1ab675bc Mon Sep 17 00:00:00 2001 From: 0Pranav Date: Thu, 7 Nov 2019 13:37:11 +0530 Subject: [PATCH] Add comemnts for tz conversions --- erpnext/www/book-appointment/index.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/www/book-appointment/index.py b/erpnext/www/book-appointment/index.py index 9765e5ea4d..707be6775c 100644 --- a/erpnext/www/book-appointment/index.py +++ b/erpnext/www/book-appointment/index.py @@ -79,13 +79,15 @@ def get_available_slots_between(query_start_time, query_end_time, settings): @frappe.whitelist(allow_guest=True) def create_appointment(date, time, tz, contact): - appointment = frappe.new_doc('Appointment') format_string = '%Y-%m-%d %H:%M:%S%z' - scheduled_time = datetime.datetime.strptime(date+" "+time, format_string) + scheduled_time = datetime.datetime.strptime(date + " " + time, format_string) + # Strip tzinfo from datetime objects since it's handled by the doctype scheduled_time = scheduled_time.replace(tzinfo=None) scheduled_time = convert_to_system_timezone(tz, scheduled_time) scheduled_time = scheduled_time.replace(tzinfo=None) + # Create a appointment document from form appointment.scheduled_time = scheduled_time + appointment = frappe.new_doc('Appointment') contact = json.loads(contact) appointment.customer_name = contact.get('name',None) appointment.customer_phone_number = contact.get('number', None)