feat: add COUNTDOWN_TIMEZONES to countdown

This commit is contained in:
2025-09-14 11:18:58 +04:00
parent e5505ebdc0
commit a7def8537f
4 changed files with 198 additions and 4 deletions
+39 -2
View File
@@ -98,8 +98,45 @@ setSecurityHeaders();
<p>La plateforme ouvrira ses portes le <strong><?php
$targetDate = new DateTime(COUNTDOWN_TARGET_DATE);
setlocale(LC_TIME, 'fr_FR.UTF-8');
echo strftime('%e %B %Y', $targetDate->getTimestamp());
?></strong>.</p>
echo strftime('%e %B %Y à %H:%M', $targetDate->getTimestamp());
?></strong> (heure de La Réunion).</p>
<!-- Heures des autres territoires -->
<div class="countdown-other-timezones">
<?php
$timezones = defined('COUNTDOWN_TIMEZONES') ? COUNTDOWN_TIMEZONES : [
'Martinique/Guadeloupe' => 'America/Martinique',
'Guyane' => 'America/Cayenne',
'France' => 'Europe/Paris',
'Ma\'ohi Nui' => 'Pacific/Tahiti',
'Kanaky' => 'Pacific/Noumea'
];
foreach($timezones as $name => $timezone):
$targetDateLocal = new DateTime(COUNTDOWN_TARGET_DATE, new DateTimeZone('Indian/Reunion'));
$targetDateLocal->setTimezone(new DateTimeZone($timezone));
// Vérifier si c'est un jour différent
$reunionDate = new DateTime(COUNTDOWN_TARGET_DATE);
$dayDiff = $targetDateLocal->format('j') - $reunionDate->format('j');
$dayIndicator = '';
if ($dayDiff > 0) {
$dayIndicator = ' <span class="day-indicator next-day">+1j</span>';
} elseif ($dayDiff < 0) {
$dayIndicator = ' <span class="day-indicator prev-day">-1j</span>';
}
?>
<div class="timezone-item">
<span class="timezone-name"><?php echo $name; ?></span>
<span class="timezone-time">
<?php echo $targetDateLocal->format('H:i'); ?>
<?php echo $dayIndicator; ?>
</span>
</div>
<?php endforeach; ?>
</div>
<p>Restez connectés et suivez-nous sur nos réseaux sociaux !</p>
</div>