Mondbedeckungen von Planeten als Kontakte ausgeben

This commit is contained in:
2026-09-12 10:40:35 +02:00
parent dd430bcfd1
commit b5c7248a64
2 changed files with 137 additions and 3 deletions
+16 -2
View File
@@ -1022,6 +1022,19 @@ if (!function_exists('monthForecastBuildNarrativeText')) {
$sepStr = ' in nur ' . $sepMatch[1] . ' Abstand';
}
$apSd = $shortDate($apDate !== '' ? $apDate : $date);
$eventKind = (string) ($ap['event_kind'] ?? '');
if ($eventKind !== '' && str_starts_with($apLabel, 'Mond bedeckt ')) {
$target = substr($apLabel, strlen('Mond bedeckt '));
$apTime = trim((string) ($ap['time'] ?? ''));
$timeClause = $apTime !== '' ? ' um ' . $apTime . ' Uhr' : '';
$moonSentences[] = match ($eventKind) {
'start' => 'Am ' . $apSd . $timeClause . ' beginnt die Bedeckung von ' . $target . ' durch den Mond.',
'maximum' => 'Am ' . $apSd . $timeClause . ' erreicht die Bedeckung von ' . $target . ' durch den Mond ihr Maximum.',
'end' => 'Am ' . $apSd . $timeClause . ' endet die Bedeckung von ' . $target . ' durch den Mond.',
default => 'Am ' . $apSd . $timeClause . ' bedeckt der Mond ' . $target . '.',
};
continue;
}
if (str_starts_with($apLabel, 'Mond nahe ')) {
$target = substr($apLabel, strlen('Mond nahe '));
$moonSentences[] = 'Am ' . $apSd . ' zieht der Mond' . $sepStr . ' an ' . $target . ' vorbei.';
@@ -2451,7 +2464,8 @@ foreach ($moonPlanetApproaches as $approachEvent) {
continue;
}
$distanceText = isset($approachEvent['separation_deg'])
$eventKind = (string) ($approachEvent['event_kind'] ?? '');
$distanceText = $eventKind === '' && isset($approachEvent['separation_deg'])
? number_format((float) $approachEvent['separation_deg'], 2, ',', '') . ' Grad'
: '';
@@ -2460,7 +2474,7 @@ foreach ($moonPlanetApproaches as $approachEvent) {
'date' => (string) ($approachEvent['local_date'] ?? ''),
'time' => (string) ($approachEvent['local_time'] ?? ''),
'local_iso' => (string) ($approachEvent['local_iso'] ?? ''),
'type' => 'moon_planet',
'type' => $eventKind !== '' ? 'moon_occultation' : 'moon_planet',
];
}