@php
$dateOfBirth = \Carbon\Carbon::parse($Package->DATE_OF_BIRTH);
$timeOfBirth = \Carbon\Carbon::parse($Package->TIME_OF_BIRTH);
$current = $Package->COLLECTION_TIME ?? Carbon\Carbon::now();
$ageInYears = $dateOfBirth->diffInYears($current);
$ageInMonths = $dateOfBirth->diffInMonths($current);
if ($ageInYears >= 1) {
$age = '- ' . $ageInYears . ' Year' . ($ageInYears !== 1 ? 's' : '');
} elseif ($ageInMonths > 0) {
$age = '- ' . $ageInMonths . ' Month' . ($ageInMonths !== 1 ? 's' : '');
} else {
$days = $dateOfBirth->diffInDays($current);
$hours = $timeOfBirth->diffInHours($current) % 24;
$age = "
$days Days, $hours Hours";
}
@endphp