diff --git a/tournaments/templates/register_tournament.html b/tournaments/templates/register_tournament.html index 91117e8..eda6feb 100644 --- a/tournaments/templates/register_tournament.html +++ b/tournaments/templates/register_tournament.html @@ -38,7 +38,7 @@

Votre session d'inscription est active. Complétez le formulaire dans le délai accordé pour confirmer votre participation et garantir votre place.

{% if not cart_data.is_cart_expired %}

Votre session d'inscription expirera le {{ cart_data.expiry|date:"d/m/Y à H:i" }}

-

Temps restant: {{ cart_data.expiry|timeuntil }}

+

Temps restant: {{ cart_data.expiry|timeuntil }}

{% else %}

Votre session d'inscription a expiré. Veuillez recommencer le processus d'inscription. Votre place n'est plus garantie. @@ -236,18 +236,12 @@ document.addEventListener('DOMContentLoaded', function() { return; } - // Get the expiry date from the data attribute - const expiryDateStr = countdownElement.getAttribute('data-expiry'); - if (!expiryDateStr) return; + // Get the expiry date from the data attribute (Unix timestamp) + const expiryTimestamp = countdownElement.getAttribute('data-expiry'); + if (!expiryTimestamp) return; - // Parse the expiry date properly (keeping local time interpretation) - // Format received: "YYYY-MM-DD HH:MM:SS" - const [datePart, timePart] = expiryDateStr.split(' '); - const [year, month, day] = datePart.split('-').map(Number); - const [hours, minutes, seconds] = timePart.split(':').map(Number); - - // Create date object using local time components (month is 0-indexed in JS) - const expiryDate = new Date(year, month-1, day, hours, minutes, seconds); + // Convert Unix timestamp to Date object + const expiryDate = new Date(parseInt(expiryTimestamp) * 1000); // Function to update countdown text function updateCountdown() {