2025-06-30 12:37:33 +02:00
|
|
|
const COOKIE_NAME = "hasRsvped";
|
|
|
|
|
|
|
|
|
|
function hasRsvped() {
|
|
|
|
|
const cookies = Object.fromEntries(
|
|
|
|
|
document.cookie.split(";").map((x) => x.trim().split("="))
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return cookies[COOKIE_NAME] === "true";
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-23 14:46:56 +01:00
|
|
|
function padTime(t) {
|
|
|
|
|
return `${t}`.padStart(2, '0');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function updateCountdown() {
|
|
|
|
|
const countdownDate = new Date("2026-05-16T14:30:00.000+02:00");
|
|
|
|
|
const now = new Date();
|
|
|
|
|
const msRemaining = countdownDate.getTime() - now.getTime();
|
|
|
|
|
const daysRemaining = Math.floor(msRemaining / (1000 * 60 * 60 * 24));
|
|
|
|
|
const hoursRemaining = Math.floor(msRemaining / (1000 * 60 * 60)) % 24;
|
|
|
|
|
const minutesRemaining = Math.floor(msRemaining / (1000 * 60)) % 60;
|
|
|
|
|
const secondsRemaining = Math.floor(msRemaining / 1000) % 60;
|
|
|
|
|
const countdownNode = document.getElementById("countdown");
|
|
|
|
|
countdownNode.innerText = `${daysRemaining} days ${padTime(hoursRemaining)}:${padTime(minutesRemaining)}:${padTime(secondsRemaining)}`;
|
|
|
|
|
}
|
2025-06-30 12:37:33 +02:00
|
|
|
|
|
|
|
|
window.onload = function () {
|
|
|
|
|
if (!hasRsvped()) {
|
|
|
|
|
const rsvpButton = document.querySelector(".rsvpButton");
|
|
|
|
|
rsvpButton.classList.remove("hidden");
|
|
|
|
|
}
|
2026-03-23 14:46:56 +01:00
|
|
|
updateCountdown();
|
|
|
|
|
window.setInterval(updateCountdown, 500);
|
2025-06-30 12:37:33 +02:00
|
|
|
};
|