Skip to content

Commit

Permalink
Include start date for Prescription timeline cells (#7067)
Browse files Browse the repository at this point in the history
* Include start date for Prescription timeline cells

* Change heading

* heading
  • Loading branch information
Ashesh3 authored Jan 19, 2024
1 parent 85b6a30 commit d0fdfc9
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import dayjs from "../../../Utils/dayjs";
import { MedicineAdministrationRecord, Prescription } from "../models";
import CareIcon from "../../../CAREUI/icons/CareIcon";
import { classNames, formatDateTime, formatTime } from "../../../Utils/utils";
import { classNames, formatDateTime } from "../../../Utils/utils";
import DialogModal from "../../Common/Dialog";
import PrescrpitionActivityTimeline from "../PrescrpitionTimeline";
import { useState } from "react";
Expand All @@ -21,10 +21,10 @@ export default function AdministrationEventCell({
refetch,
}: Props) {
const [showTimeline, setShowTimeline] = useState(false);
// Check if cell belongs to an administered prescription
// Check if cell belongs to an administered prescription (including start and excluding end)
const administered = administrations
.filter((administration) =>
dayjs(administration.administered_date).isBetween(start, end)
dayjs(administration.administered_date).isBetween(start, end, null, "[)")
)
.sort(
(a, b) =>
Expand All @@ -46,9 +46,7 @@ export default function AdministrationEventCell({
show={showTimeline}
>
<div className="mt-6 text-sm font-medium text-gray-700">
Administrations between{" "}
<span className="text-black">{formatTime(start, "HH:mm")}</span> and{" "}
<span className="text-black">{formatTime(end, "HH:mm")}</span> on{" "}
Administrations on{" "}
<span className="text-black">
{formatDateTime(start, "DD/MM/YYYY")}
</span>
Expand Down

0 comments on commit d0fdfc9

Please sign in to comment.