Skip to content

Commit

Permalink
(fix) O3-3902 - make age() function (and its usage) handle null birth… (
Browse files Browse the repository at this point in the history
  • Loading branch information
chibongho authored Sep 3, 2024
1 parent 04c991e commit 2543e1b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,13 @@ const PatientBanner: React.FC<PatientBannerProps> = ({ patient, patientUuid, hid
/>
</div>
<div className={styles.demographics}>
<span>{getGender(patient.person.gender)}</span> &middot; <span>{age(patient.person.birthdate)}</span>{' '}
&middot; <span>{formatDate(parseDate(patient.person.birthdate), { mode: 'wide', time: false })}</span>
<span>{getGender(patient.person.gender)}</span>
{patient.person.birthdate && (
<>
&middot; <span>{age(patient.person.birthdate)}</span> &middot;{' '}
<span>{formatDate(parseDate(patient.person.birthdate), { mode: 'wide', time: false })}</span>
</>
)}
</div>
<div>
<div className={styles.identifiers}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface WardPatientAgeProps {
}

const WardPatientAge: React.FC<WardPatientAgeProps> = ({ patient }) => {
return <div>{age(patient.person?.birthdate)}</div>;
return patient.person?.birthdate ? <div>{age(patient.person.birthdate)}</div> : null;
};

export default WardPatientAge;
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ const PatientWorkspaceTitle: React.FC<WardPatientWorkspaceViewProps> = ({ patien
<>
<div>{patient.person.display} &nbsp;</div>
<div className={styles.headerPatientDetail}>&middot; &nbsp; {getGender(t, patient.person?.gender)}</div>
<div className={styles.headerPatientDetail}>&middot; &nbsp; {age(patient.person?.birthdate)}</div>
{patient.person?.birthdate && (
<div className={styles.headerPatientDetail}>&middot; &nbsp; {age(patient.person?.birthdate)}</div>
)}
</>
);
};

0 comments on commit 2543e1b

Please sign in to comment.