@ -38,7 +38,7 @@
< p > Votre session d'inscription est active. Complétez le formulaire dans le délai accordé pour confirmer votre participation et garantir votre place.< / p >
{% if not cart_data.is_cart_expired %}
< p class = "semibold highlight" > Votre session d'inscription expirera le {{ cart_data.expiry|date:"d/m/Y à H:i" }}< / p >
< p > Temps restant: < span id = "countdown" data-expiry = "{{ cart_data.expiry|date:'Y-m-d H:i:s ' }}" > {{ cart_data.expiry|timeuntil }}< / span > < / p >
< p > Temps restant: < span id = "countdown" data-expiry = "{{ cart_data.expiry|date:'U ' }}" > {{ cart_data.expiry|timeuntil }}< / span > < / p >
{% else %}
< p class = "alert alert-danger" >
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() {