Skip to content

Commit

Permalink
Improve how time is shown in Administrations Timeline (#6685)
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad authored Nov 23, 2023
1 parent c1c4e56 commit 39cd0fa
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Components/Medicine/PrescrpitionTimeline.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import dayjs from "../../Utils/dayjs";
import useSlug from "../../Common/hooks/useSlug";
import useQuery from "../../Utils/request/useQuery";
import { classNames, formatDateTime } from "../../Utils/utils";
import { classNames, formatDateTime, formatTime } from "../../Utils/utils";
import { MedicineAdministrationRecord, Prescription } from "./models";
import MedicineRoutes from "./routes";
import Timeline, {
Expand Down Expand Up @@ -120,7 +120,9 @@ const MedicineAdministeredNode = ({
event={event}
className={classNames(event.cancelled && "opacity-70")}
// TODO: to add administered dosage when Titrated Prescriptions are implemented
// titleSuffix={`administered ${event.administration.dosage}.`}
titleSuffix={`administered the medicine at ${formatTime(
event.administration.administered_date
)}.`}
actions={
!event.cancelled &&
!hideArchive && (
Expand Down Expand Up @@ -198,13 +200,14 @@ const compileEvents = (
administrations
.sort(
(a, b) =>
new Date(a.created_date).getTime() - new Date(b.created_date).getTime()
new Date(a.administered_date!).getTime() -
new Date(b.administered_date!).getTime()
)
.forEach((administration) => {
events.push({
type: "administered",
icon: "l-syringe",
timestamp: administration.created_date,
timestamp: administration.administered_date!,
by: administration.administered_by,
cancelled: !!administration.archived_on,
administration,
Expand Down

0 comments on commit 39cd0fa

Please sign in to comment.