-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.js
More file actions
14 lines (11 loc) · 819 Bytes
/
script.js
File metadata and controls
14 lines (11 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
const COUNTDOWN_FINISH_DATE = new Date("2023-02-17T14:00:00");
window.addEventListener("load", function() {
requestAnimationFrame(function update() {
var timeLeft = Math.max(COUNTDOWN_FINISH_DATE.getTime() - Date.now(), 0);
document.querySelector(".countdownSeconds").textContent = String(Math.floor(timeLeft / 1_000) % 60).padStart(2, "0");
document.querySelector(".countdownMinutes").textContent = String(Math.floor(timeLeft / (1_000 * 60)) % 60).padStart(2, "0");
document.querySelector(".countdownHours").textContent = String(Math.floor(timeLeft / (1_000 * 60 * 60)) % 24).padStart(2, "0");
document.querySelector(".countdownDays").textContent = String(Math.floor(timeLeft / (1_000 * 60 * 60 * 24))).padStart(2, "0");
requestAnimationFrame(update);
});
});