Remove redundant date range calculation logic from buildNewsletterHtml function in index.php and wiki.php. This cleanup enhances code maintainability by eliminating unnecessary complexity.

This commit is contained in:
smueller
2026-07-07 11:06:10 +02:00
parent d1e3ccc00c
commit ec13c9680d
2 changed files with 0 additions and 32 deletions

View File

@@ -353,22 +353,6 @@ function buildNewsletterHtml(array $config, array $articles, string $periodLabel
$rangeEnd = new DateTimeImmutable('today');
}
$dateRangeText = 'vom ' . $periodStart->format('d.m') . ' bis ' . $rangeEnd->format('d.m');
if ($isTest && !empty($articles)) {
$timestamps = [];
foreach ($articles as $article) {
$date = DateTimeImmutable::createFromFormat('Y-m-d', (string)($article['date'] ?? ''));
if ($date instanceof DateTimeImmutable) {
$timestamps[] = $date->getTimestamp();
}
}
if (!empty($timestamps)) {
sort($timestamps);
$from = (new DateTimeImmutable('@' . (string)$timestamps[0]))->setTimezone(new DateTimeZone(date_default_timezone_get()));
$to = (new DateTimeImmutable('@' . (string)$timestamps[count($timestamps) - 1]))->setTimezone(new DateTimeZone(date_default_timezone_get()));
$dateRangeText = 'vom ' . $from->format('d.m') . ' bis ' . $to->format('d.m');
}
}
$articleRows = '';
if ($count === 0) {