From 7c9751d13ec9d2d402903769b41d5b58e4d1be2f Mon Sep 17 00:00:00 2001 From: Aditya Jindal Date: Fri, 29 Nov 2024 11:58:38 +0530 Subject: [PATCH] Fix: Date of Birth to Year of Birth on Patient Details Page when DOB is Missing (#9242) --- public/locale/en.json | 3 ++- .../Patient/PatientDetailsTab/Demography.tsx | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/public/locale/en.json b/public/locale/en.json index 56f84a1883a..cd921bef06a 100644 --- a/public/locale/en.json +++ b/public/locale/en.json @@ -562,7 +562,7 @@ "date_and_time": "Date and Time", "date_declared_positive": "Date of declaring positive", "date_of_admission": "Date of Admission", - "date_of_birth": "Date of birth", + "date_of_birth": "Date of Birth", "date_of_positive_covid_19_swab": "Date of Positive Covid 19 Swab", "date_of_result": "Covid confirmation date", "date_of_return": "Date of Return", @@ -1433,6 +1433,7 @@ "why_the_asset_is_not_working": "Why the asset is not working?", "width": "Width ({{unit}})", "working_status": "Working Status", + "year_of_birth": "Year of Birth", "years": "years", "years_of_experience": "Years of Experience", "years_of_experience_of_the_doctor": "Years of Experience of the Doctor", diff --git a/src/components/Patient/PatientDetailsTab/Demography.tsx b/src/components/Patient/PatientDetailsTab/Demography.tsx index 7ac854b8ee6..2a412f03f9a 100644 --- a/src/components/Patient/PatientDetailsTab/Demography.tsx +++ b/src/components/Patient/PatientDetailsTab/Demography.tsx @@ -188,12 +188,19 @@ export const Demography = (props: PatientProps) => { ), }, { - label: t("date_of_birth"), - value: ( + label: t( + patientData.date_of_birth ? "date_of_birth" : "year_of_birth", + ), + value: patientData.date_of_birth ? ( <> {dayjs(patientData.date_of_birth).format("DD MMM YYYY")} ( {formatPatientAge(patientData, true)}) + ) : ( + <> + {patientData.year_of_birth} ({formatPatientAge(patientData, true)} + ) + ), }, {