forked from txruno/Scratch-Building-website
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
21 lines (16 loc) · 745 Bytes
/
index.js
File metadata and controls
21 lines (16 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const targetDate = new Date('2023-12-01T17:00:00+09:00').getTime();
function updateCountdown() {
const now = new Date().getTime();
const distance = targetDate - now;
const days = Math.floor(distance / (1000 * 60 * 60 * 24));
const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((distance % (1000 * 60)) / 1000);
document.getElementById('countdown').innerHTML = `公開まで: ${days}日 ${hours}:${minutes}:${seconds}`;
if (distance < 0) {
document.getElementById('countdown').innerHTML = 'Scratchで公開中!';
} else {
setTimeout(updateCountdown, 1000);
}
}
updateCountdown();