wip: insurance booking phases 1 and 2

This commit is contained in:
Björn Fromme
2026-03-16 11:59:10 +01:00
parent 411166ffba
commit 241785b428
8 changed files with 1109 additions and 4 deletions
+6 -4
View File
@@ -108,21 +108,23 @@ class ParticipantDto
}
/**
* Calculates the participant's current age in complete years.
* Calculates the participant's age in complete years.
*
* Uses the same logic as existing age evaluators in the system
* for consistency across age-related calculations.
*
* @param \DateTimeImmutable|null $referenceDate The date to calculate age at (defaults to current date)
*
* @return int|null The calculated age in complete years, or null if no birth date
*/
public function getAge(): ?int
public function getAge(?\DateTimeImmutable $referenceDate = null): ?int
{
if (null === $this->dateOfBirth) {
return null;
}
$today = new \DateTimeImmutable();
$referenceDate = $referenceDate ?? new \DateTimeImmutable();
return $this->dateOfBirth->diff($today)->y;
return $this->dateOfBirth->diff($referenceDate)->y;
}
}