age format

This commit is contained in:
CHIEFSOFT\ameye
2023-10-23 15:28:14 -04:00
parent 0fd25a6efa
commit ac76b185fb
+11 -1
View File
@@ -104,6 +104,16 @@ class ResultFormatter extends Model
return 'default.svg';
}
function GetFamilyAge($age,$year,$month){
$currAge= $age;
if ($year > 0 && $month > 0 ){
$bdate="$year/$month/1";
$currAge = date_diff(date_create($bdate), date_create('now'))->y;
}
return $currAge;
}
public function processOutJson($in, $out) {
@@ -396,7 +406,7 @@ class ResultFormatter extends Model
"family_uid" => $out["uid_${key}"],
"firstname" => $out["firstname_${key}"],
"lastname" => $out["lastname_${key}"],
"age" => $out["age_${key}"],
"age" => $this->GetFamilyAge( $out["age_${key}"],$out["year_${key}"],$out["month_${key}"]),
"year" => $out["year_${key}"],
"month" => $out["month_${key}"],
"last_login" => $out["last_login_${key}"],