fix: ISO countdown date, IntlDateFormatter and UTF-8 truncation

This commit is contained in:
2026-07-27 09:15:10 +04:00
parent cb13fcfb9f
commit ddd82fdff6
5 changed files with 233 additions and 28 deletions
+13 -13
View File
@@ -20,7 +20,7 @@ setSecurityHeaders();
<!-- Styles -->
<link rel="stylesheet" href="css/countdown.css?v=<?php echo filemtime('css/countdown.css'); ?>">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.0.1/css/all.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.0.1/css/all.min.css" integrity="sha512-2SwdPD6INVrV/lHTZbO2nodKhrnDdJK9/kg2XD1r9uGqPo1cUbujc+IYdlYdEErWNu69gVcYgdxlmVmzTWnetw==" crossorigin="anonymous">
<!-- Favicons -->
<link rel="apple-touch-icon" sizes="180x180" href="img/apple-touch-icon.png">
@@ -40,9 +40,7 @@ setSecurityHeaders();
<!-- Open Graph Meta Tags -->
<meta property="og:title" content="<?php echo SITE_NAME; ?> - Ouverture prochaine">
<meta property="og:description" content="La plateforme multimédia <?php echo SITE_NAME; ?> ouvrira ses portes le <?php
$targetDate = new DateTime(COUNTDOWN_TARGET_DATE);
setlocale(LC_TIME, 'fr_FR.UTF-8');
echo strftime('%e %B %Y', $targetDate->getTimestamp());
echo formatDateFr(new DateTime(COUNTDOWN_TARGET_DATE));
?>. Restez connectés !">
<meta property="og:image" content="<?php echo getBaseUrl() . '/img/logo.png'; ?>">
<meta property="og:url" content="<?php echo htmlspecialchars(getCurrentUrl()); ?>">
@@ -54,15 +52,19 @@ setSecurityHeaders();
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="<?php echo SITE_NAME; ?> - Ouverture prochaine">
<meta name="twitter:description" content="La plateforme multimédia <?php echo SITE_NAME; ?> ouvrira ses portes le <?php
$targetDate = new DateTime(COUNTDOWN_TARGET_DATE);
setlocale(LC_TIME, 'fr_FR.UTF-8');
echo strftime('%e %B %Y', $targetDate->getTimestamp());
echo formatDateFr(new DateTime(COUNTDOWN_TARGET_DATE));
?>. Restez connectés !">
<meta name="twitter:image" content="<?php echo getBaseUrl() . '/img/logo.png'; ?>">
<!-- Configuration JavaScript -->
<!-- Configuration JavaScript : date cible en ISO 8601 avec fuseau horaire -->
<script nonce="<?php echo getCspNonce(); ?>">
const COUNTDOWN_TARGET_DATE = '<?php echo defined('COUNTDOWN_TARGET_DATE') ? COUNTDOWN_TARGET_DATE : '2025-10-11 00:00:00'; ?>';
const COUNTDOWN_TARGET_DATE = '<?php
$countdownTargetDate = new DateTime(
defined('COUNTDOWN_TARGET_DATE') ? COUNTDOWN_TARGET_DATE : '2025-10-11 00:00:00',
new DateTimeZone(DEFAULT_TIMEZONE)
);
echo $countdownTargetDate->format(DateTime::ATOM);
?>';
</script>
</head>
<body>
@@ -99,10 +101,8 @@ setSecurityHeaders();
<!-- Message -->
<div class="countdown-message">
<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 à %H:%M', $targetDate->getTimestamp());
<p>La plateforme ouvrira ses portes le <strong><?php
echo formatDateFr(new DateTime(COUNTDOWN_TARGET_DATE), true);
?></strong> (heure de La Réunion).</p>
<!-- Heures des autres territoires -->