Skip to content

Commit

Permalink
OTP schedule timezone fix (#9676)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacobjeevan authored Jan 3, 2025
1 parent 34d7cbb commit 09f4b97
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/pages/Appoinments/Schedule.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useQuery } from "@tanstack/react-query";
import { format } from "date-fns";
import dayjs from "dayjs";
import { Link, navigate } from "raviger";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
Expand Down Expand Up @@ -249,7 +249,11 @@ export function ScheduleAppointment(props: AppointmentsProps) {
className="flex flex-col items-center group py-6 gap-1"
>
<span className="font-semibold">
{format(slot.start_datetime, "HH:mm")}
{/* TODO: remove this once BE is updated */}
{dayjs(slot.start_datetime)
.add(-5, "hours")
.add(-30, "minutes")
.format("HH:mm")}
</span>
<span
className={cn(
Expand Down
11 changes: 11 additions & 0 deletions src/pages/Patient/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ function PatientIndex() {

const appointments = appointmentsData?.results
.filter((appointment) => appointment?.patient.id == selectedPatient?.id)
.map((appointment) => ({
...appointment,
token_slot: {
...appointment.token_slot,
// TODO: remove this once BE is updated
start_datetime: dayjs(appointment.token_slot.start_datetime)
.add(-5, "hours")
.add(-30, "minutes")
.toISOString(),
},
}))
.sort(
(a, b) =>
new Date(a.token_slot.start_datetime).getTime() -
Expand Down
5 changes: 5 additions & 0 deletions src/types/organization/organizationApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,9 @@ export default {
method: HttpMethod.GET,
TRes: Type<PaginatedResponse<Organization>>(),
},
getPublicOrganization: {
path: "/api/v1/govt/organization/{id}/",
method: HttpMethod.GET,
TRes: Type<Organization>(),
},
};

0 comments on commit 09f4b97

Please sign in to comment.