diff --git a/app/Controllers/Patient.php b/app/Controllers/Patient.php index ec61b18..ffd0a4e 100644 --- a/app/Controllers/Patient.php +++ b/app/Controllers/Patient.php @@ -398,7 +398,17 @@ class Patient extends Controller { $today = new \DateTime(); $diff = $today->diff($dob); - $formattedAge = "{$diff->y} years {$diff->m} months {$diff->d} days"; + $formattedAge = ""; + if ($diff->y > 0){ + $formattedAge .= "{$diff->y} Tahun "; + } + if ($diff->m > 0){ + $formattedAge .= "{$diff->m} Bulan "; + } + if ($diff->d > 0){ + $formattedAge .= "{$diff->d} Hari "; + } + return $formattedAge; }