Skip to content

Commit

Permalink
use ternary operator
Browse files Browse the repository at this point in the history
  • Loading branch information
rajku-dev committed Jan 13, 2025
1 parent 38d1377 commit cad9cd0
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/pages/Appointments/AppointmentDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -289,26 +289,25 @@ const AppointmentDetails = ({
<div>
<p className="font-medium">{appointment.patient.name}</p>
<p className="text-gray-600">
{(appointment.patient.date_of_birth && (
{appointment.patient.date_of_birth ? (
<>
{format(appointment.patient.date_of_birth, "MMMM d, yyyy")}
{" | "}
{format(appointment.patient.date_of_birth, "MMMM d, yyyy")}{" "}
|{" "}
{differenceInYears(
new Date(),
appointment.patient.date_of_birth!,
)}
</>
)) ||
(appointment.patient.year_of_birth && (
<>
{differenceInYears(
new Date(),
new Date().setFullYear(
Number(appointment.patient.year_of_birth),
),
)}
</>
))}{" "}
) : appointment.patient.year_of_birth ? (
<>
{differenceInYears(
new Date(),
new Date().setFullYear(
Number(appointment.patient.year_of_birth),
),
)}
</>
) : null}{" "}
{t("years")}
</p>
</div>
Expand Down

0 comments on commit cad9cd0

Please sign in to comment.