$birthdays * @var Collection|null $anniversaries * @var Collection|null $historical * @var bool $include_anniversaries * @var bool $include_historical * @var int $lookahead_days * @var int $historical_lookahead * @var int $generated_at * @var string $account_url */ $record_label = static function (Fact $fact): string { $record = $fact->record(); if ($record instanceof Individual) { return strip_tags($record->fullName()); } if ($record instanceof Family) { $husband = $record->husband(); $wife = $record->wife(); $names = array_filter([ $husband !== null ? strip_tags($husband->fullName()) : '', $wife !== null ? strip_tags($wife->fullName()) : '', ]); return implode(' & ', $names); } return $record->xref(); }; $event_date = static function (Fact $fact): string { $date = $fact->date(); if (!$date instanceof Date || !$date->isOK()) { return ''; } return strip_tags($date->display()); }; /** * Age the person/couple actually turns on the upcoming anniversary, not * their current age. We use the fact's own year (which on an anniversary * Fact is the year of the original event — birth or marriage) and the * year of the upcoming Julian day stored on the Fact ($fact->jd) so the * calculation handles people whose birthday falls before vs. after today * uniformly. */ $upcoming_age = static function (Fact $fact): int { static $gregorian = null; $gregorian ??= new \Fisharebest\ExtCalendar\GregorianCalendar(); $date = $fact->date(); if (!$date->isOK()) { return 0; } $event_year = $date->gregorianYear(); $upcoming_jd = $fact->jd ?? 0; if ($upcoming_jd > 0) { [$upcoming_year] = $gregorian->jdToYmd($upcoming_jd); } else { $upcoming_year = (int) date('Y'); } return max(0, $upcoming_year - $event_year); }; /** * Locale-aware ordinal. English uses st/nd/rd/th suffixes; German (and * most other European languages we currently support) just appends a * period to the digits. */ $ordinal = static function (int $n): string { if (str_starts_with(I18N::languageTag(), 'de')) { return $n . '.'; } $abs = abs($n); $mod100 = $abs % 100; if ($mod100 >= 11 && $mod100 <= 13) { return $n . 'th'; } return $n . match ($abs % 10) { 1 => 'st', 2 => 'nd', 3 => 'rd', default => 'th', }; }; $birthday_label = static function (int $age) use ($ordinal): string { if ($age <= 0) { return I18N::translate('Birthday'); } return I18N::translate('%s birthday', $ordinal($age)); }; $anniversary_label = static function (int $age) use ($ordinal): string { if ($age <= 0) { return I18N::translate('Wedding anniversary'); } return I18N::translate('%s wedding anniversary', $ordinal($age)); }; ?> <?= e(I18N::translate('Family newsletter — %s', date('F j, Y', $generated_at))) ?>

title()) ?>

isEmpty()) : ?>

isEmpty()) : ?>

isEmpty()) : ?>


title())) ?>
' . e(I18N::translate('My account')) . '', ) ?>