-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
27 lines (21 loc) · 1.1 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Set the target date (December 31, 2024)
const targetDate = new Date('2025-04-05T00:00:00+0530').getTime();
function updateCountdown() {
const now = new Date().getTime();
const timeLeft = targetDate - now;
const days = Math.floor(timeLeft / (1000 * 60 * 60 * 24));
const hours = Math.floor((timeLeft % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((timeLeft % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((timeLeft % (1000 * 60)) / (1000));
// Add leading zeros
document.getElementById('days').textContent = days.toString().padStart(2, '0');
document.getElementById('hours').textContent = hours.toString().padStart(2, '0');
document.getElementById('minutes').textContent = minutes.toString().padStart(2, '0');
document.getElementById("seconds").textContent = String(seconds).padStart(2, '0');
if (timeLeft < 0) {
clearInterval(timerInterval);
document.getElementById('countdown').innerHTML = '<h2>Registration Closed</h2>';
}
}
const timerInterval = setInterval(updateCountdown, 1000);
updateCountdown();