// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later

const target = new Date("May 7, 2025 16:30:00 GMT+0200");

function update_time() {
	let countdown = document.querySelector(".countdown");

	const now = new Date();

	if(now >= target) {
		countdown.innerHTML = "Akce již proběhla.<br>Děkujeme všem za návštěvu.";
		return;
	}

	const dur = Math.floor((target - now) / 1000);

	const day = Math.floor(dur / 86400).toFixed(0).padStart(2, "0");
	const hour = Math.floor((dur / 3600) % 24).toFixed(0).padStart(2, "0");
	const min = Math.floor((dur / 60) % 60).toFixed(0).padStart(2, "0");
	const sec = Math.floor(dur % 60).toFixed(0).padStart(2, "0");

	//const targetdate = `${target.getDate()}. ${target.getMonth()+1}. ${target.getFullYear()}`
	//const targettime = `${target.getHours()}:${target.getMinutes()}`

	//countdown.innerHTML = `${targetdate} v ${targettime}<br><br>${day}:${hour}:${min}:${sec}`;
	countdown.innerHTML = `${day}:${hour}:${min}:${sec}`;
}

update_time();
setInterval(update_time, 1000);

// @license-end

