Add comemnts for tz conversions

This commit is contained in:
0Pranav 2019-11-07 13:37:11 +05:30
parent 0671ea8137
commit 83100c9c84

View File

@ -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)