Add comemnts for tz conversions
This commit is contained in:
parent
0671ea8137
commit
83100c9c84
@ -79,13 +79,15 @@ def get_available_slots_between(query_start_time, query_end_time, settings):
|
|||||||
|
|
||||||
@frappe.whitelist(allow_guest=True)
|
@frappe.whitelist(allow_guest=True)
|
||||||
def create_appointment(date, time, tz, contact):
|
def create_appointment(date, time, tz, contact):
|
||||||
appointment = frappe.new_doc('Appointment')
|
|
||||||
format_string = '%Y-%m-%d %H:%M:%S%z'
|
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 = scheduled_time.replace(tzinfo=None)
|
||||||
scheduled_time = convert_to_system_timezone(tz, scheduled_time)
|
scheduled_time = convert_to_system_timezone(tz, scheduled_time)
|
||||||
scheduled_time = scheduled_time.replace(tzinfo=None)
|
scheduled_time = scheduled_time.replace(tzinfo=None)
|
||||||
|
# Create a appointment document from form
|
||||||
appointment.scheduled_time = scheduled_time
|
appointment.scheduled_time = scheduled_time
|
||||||
|
appointment = frappe.new_doc('Appointment')
|
||||||
contact = json.loads(contact)
|
contact = json.loads(contact)
|
||||||
appointment.customer_name = contact.get('name',None)
|
appointment.customer_name = contact.get('name',None)
|
||||||
appointment.customer_phone_number = contact.get('number', None)
|
appointment.customer_phone_number = contact.get('number', None)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user