Hello team,
I’ve encountered an issue in Frappe Health where patient appointments booked for a specific date are being displayed as the previous day after saving. I’ve reviewed the patient appointment handling code and haven’t made any modifications that could cause this.
Below is the show_availability
function used in our booking system. This function sets up a dialog for booking appointments, assigns values to the form, and saves it. The issue might be related to how the appointment date is handled or saved in our system:
function show_availability() {
let selected_practitioner = '';
let d = new frappe.ui.Dialog({
title: __('Available slots'),
fields: [
{ fieldtype: 'Link', options: 'Medical Department', reqd: 1, fieldname: 'department', label: 'Medical Department' },
{ fieldtype: 'Column Break' },
{ fieldtype: 'Link', options: 'Healthcare Practitioner', reqd: 1, fieldname: 'practitioner', label: 'Healthcare Practitioner' },
{ fieldtype: 'Column Break' },
{ fieldtype: 'Date', reqd: 1, fieldname: 'appointment_date', label: 'Date', min_date: new Date(frappe.datetime.get_today()) },
{ fieldtype: 'Section Break' },
{ fieldtype: 'HTML', fieldname: 'available_slots' }
],
primary_action_label: __('Book'),
primary_action: function() {
frm.set_value('appointment_date', d.get_value('appointment_date'));
d.hide();
frm.enable_save();
frm.save();
d.get_primary_btn().attr('disabled', true);
}
});
d.set_values({
'department': frm.doc.department,
'practitioner': frm.doc.practitioner,
'appointment_date': frm.doc.appointment_date
});
}
Can anyone provide insights or suggest what might be causing this date shift? Any help would be greatly appreciated.
Thanks,
Vijayan R