Update register_tournament.html

apikeys
Razmig Sarkissian 5 months ago
parent dcc945ee6a
commit 17f59c1fcb
  1. 18
      tournaments/templates/register_tournament.html

@ -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() {

Loading…
Cancel
Save