-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
23 lines (18 loc) · 765 Bytes
/
script.js
File metadata and controls
23 lines (18 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const updateCountdown = () => {
// Release is exactly 2 weeks from now
const releaseDate = new Date();
releaseDate.setDate(releaseDate.getDate() + 14);
function refresh() {
const now = new Date().getTime();
const diff = releaseDate - now;
const d = Math.floor(diff / (1000 * 60 * 60 * 24));
const h = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const m = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
document.getElementById('days').innerText = d;
document.getElementById('hours').innerText = h < 10 ? '0'+h : h;
document.getElementById('minutes').innerText = m < 10 ? '0'+m : m;
}
setInterval(refresh, 1000);
refresh();
};
updateCountdown();