diff --git a/src/messaging/flow/tool-registry.ts b/src/messaging/flow/tool-registry.ts index 2d687a3..4bd8300 100644 --- a/src/messaging/flow/tool-registry.ts +++ b/src/messaging/flow/tool-registry.ts @@ -142,7 +142,7 @@ export class ToolRegistry { const sections: ListSection[] = [{ title: targetDate, rows: timeSlots.map(s => ({ - id: `slot:${doctorId}:${targetDate}T${s.time}:00`, + id: `slot:${doctorId}:${targetDate}T${s.time}:00+05:30`, title: s.time, description: s.clinic || undefined, })), @@ -202,7 +202,7 @@ export class ToolRegistry { // Book — include patientId so appointment is linked to patient record const result = await this.platform.query( `mutation($data: AppointmentCreateInput!) { createAppointment(data: $data) { id } }`, - { data: { name: `WhatsApp Booking — ${patientName} (${department})`, scheduledAt, status: 'SCHEDULED', doctorName, department, reasonForVisit: reason ?? 'General Consultation', ...(patientId ? { patientId } : {}) } }, + { data: { name: `WhatsApp Booking — ${patientName} (${department})`, scheduledAt: scheduledAt.includes('+') || scheduledAt.includes('Z') ? scheduledAt : `${scheduledAt}+05:30`, status: 'SCHEDULED', doctorName, department, reasonForVisit: reason ?? 'General Consultation', ...(patientId ? { patientId } : {}) } }, ); const id = result?.createAppointment?.id; if (id) { diff --git a/src/widget/widget.service.ts b/src/widget/widget.service.ts index 5f48fac..bdf2846 100644 --- a/src/widget/widget.service.ts +++ b/src/widget/widget.service.ts @@ -235,7 +235,10 @@ export class WidgetService { `mutation($data: AppointmentCreateInput!) { createAppointment(data: $data) { id } }`, { data: { name: `${req.patientName.trim() || 'Patient'} — ${new Date(req.scheduledAt).toISOString().slice(0, 10)}`, - scheduledAt: req.scheduledAt, + // Ensure IST offset — widget may send bare datetime without timezone + scheduledAt: req.scheduledAt.includes('+') || req.scheduledAt.includes('Z') + ? req.scheduledAt + : `${req.scheduledAt}+05:30`, durationMin: 30, appointmentType: 'CONSULTATION', status: 'SCHEDULED',