Update Patient show, menambahkan method untuk hitung usia pasien
This commit is contained in:
parent
46b87b8dde
commit
7623f633e6
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user