mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage-server
synced 2026-05-18 20:08:19 +00:00
fix: append IST offset (+05:30) to bare datetime in appointment booking
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Widget and WhatsApp flows send scheduledAt without timezone offset, causing platform to interpret as UTC (10:00 shows as 3:30 PM IST). Server now appends +05:30 if no timezone indicator present. Also fixed in WhatsApp slot ID generation and widget source. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -142,7 +142,7 @@ export class ToolRegistry {
|
|||||||
const sections: ListSection[] = [{
|
const sections: ListSection[] = [{
|
||||||
title: targetDate,
|
title: targetDate,
|
||||||
rows: timeSlots.map(s => ({
|
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,
|
title: s.time,
|
||||||
description: s.clinic || undefined,
|
description: s.clinic || undefined,
|
||||||
})),
|
})),
|
||||||
@@ -202,7 +202,7 @@ export class ToolRegistry {
|
|||||||
// Book — include patientId so appointment is linked to patient record
|
// Book — include patientId so appointment is linked to patient record
|
||||||
const result = await this.platform.query<any>(
|
const result = await this.platform.query<any>(
|
||||||
`mutation($data: AppointmentCreateInput!) { createAppointment(data: $data) { id } }`,
|
`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;
|
const id = result?.createAppointment?.id;
|
||||||
if (id) {
|
if (id) {
|
||||||
|
|||||||
@@ -235,7 +235,10 @@ export class WidgetService {
|
|||||||
`mutation($data: AppointmentCreateInput!) { createAppointment(data: $data) { id } }`,
|
`mutation($data: AppointmentCreateInput!) { createAppointment(data: $data) { id } }`,
|
||||||
{ data: {
|
{ data: {
|
||||||
name: `${req.patientName.trim() || 'Patient'} — ${new Date(req.scheduledAt).toISOString().slice(0, 10)}`,
|
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,
|
durationMin: 30,
|
||||||
appointmentType: 'CONSULTATION',
|
appointmentType: 'CONSULTATION',
|
||||||
status: 'SCHEDULED',
|
status: 'SCHEDULED',
|
||||||
|
|||||||
Reference in New Issue
Block a user