From 308379ecf566eb7c641ac384b5686db54a8b36a1 Mon Sep 17 00:00:00 2001 From: Ashesh <3626859+Ashesh3@users.noreply.github.com> Date: Tue, 26 Sep 2023 15:19:46 +0530 Subject: [PATCH] Display patient age in mm dd when younger than 1y (#6342) --- .../ConsultationUpdatesTab.tsx | 9 +++++-- .../Investigations/Reports/ReportTable.tsx | 12 +++++++-- .../Facility/Investigations/Reports/index.tsx | 5 +++- src/Components/Facility/LegacyMonitorCard.tsx | 3 ++- src/Components/Facility/TreatmentSummary.tsx | 5 ++-- src/Components/Patient/ManagePatients.tsx | 6 +++-- src/Components/Patient/PatientHome.tsx | 9 +++++-- src/Components/Patient/PatientInfoCard.tsx | 4 +-- src/Components/Patient/SampleDetails.tsx | 4 +-- src/Components/Shifting/ListView.tsx | 9 +++++-- src/Components/Shifting/ShiftDetails.tsx | 14 +++++++--- src/Components/Shifting/ShiftingBoard.tsx | 9 +++++-- src/Utils/utils.ts | 27 +++++++++++++++++++ 13 files changed, 92 insertions(+), 24 deletions(-) diff --git a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx index 705b3d9479a..1b89f3980e1 100644 --- a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx +++ b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx @@ -10,7 +10,7 @@ import useVitalsAspectRatioConfig from "../../VitalsMonitor/useVitalsAspectRatio import { DISCHARGE_REASONS, SYMPTOM_CHOICES } from "../../../Common/constants"; import PrescriptionsTable from "../../Medicine/PrescriptionsTable"; import Chip from "../../../CAREUI/display/Chip"; -import { formatDate, formatDateTime } from "../../../Utils/utils"; +import { formatAge, formatDate, formatDateTime } from "../../../Utils/utils"; import ReadMore from "../../Common/components/Readmore"; import { DailyRoundsList } from "../Consultations/DailyRoundsList"; @@ -621,7 +621,12 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
Name: {patientDetails.name}
-Age: {patientDetails.age}
++ Age:{" "} + {formatAge( + patientDetails.age, + patientDetails.date_of_birth, + true + )} +
Hospital: {patientDetails.hospitalName}
- {patient.age} years + {formatAge(patient.age, patient.date_of_birth, true)} • {patient.gender} {consultation?.suggestion === "DC" && ( diff --git a/src/Components/Patient/SampleDetails.tsx b/src/Components/Patient/SampleDetails.tsx index a5f802115bd..7814109978b 100644 --- a/src/Components/Patient/SampleDetails.tsx +++ b/src/Components/Patient/SampleDetails.tsx @@ -8,7 +8,7 @@ import Card from "../../CAREUI/display/Card"; import { FileUpload } from "./FileUpload"; import Page from "../Common/components/Page"; import _ from "lodash"; -import { formatDateTime } from "../../Utils/utils"; +import { formatAge, formatDateTime } from "../../Utils/utils"; import { getTestSample } from "../../Redux/actions"; import { navigate } from "raviger"; @@ -118,7 +118,7 @@ export const SampleDetails = ({ id }: SampleDetailsProps) => { ) : (