forked from gokul-00/Tri-NIT-Hackathon.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
timer.js
36 lines (31 loc) · 1.19 KB
/
timer.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
28
29
30
31
32
33
34
35
36
(function () {
const second = 1000,
minute = second * 60,
hour = minute * 60,
day = hour * 24;
let RegistrationEndDate = new Date("January 27, 2022 23:59:59");
const countDown = new Date(RegistrationEndDate).getTime(),
x = setInterval(function () {
const now = new Date().getTime(),
distance = countDown - now;
if (distance < 0) {
document.getElementById("headline").innerText =
"Registrations Opening Soon!";
// document.getElementById("register").innerText = "Go to dashboard";
document.getElementById("countdown").style.display = "none";
if (document.getElementById("content"))
document.getElementById("content").style.display = "block";
clearInterval(x);
}
(document.getElementById("days").innerText = Math.floor(distance / day)),
(document.getElementById("hours").innerText = Math.floor(
(distance % day) / hour
)),
(document.getElementById("minutes").innerText = Math.floor(
(distance % hour) / minute
)),
(document.getElementById("seconds").innerText = Math.floor(
(distance % minute) / second
));
}, 0);
})();