-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
31 lines (24 loc) · 1.03 KB
/
app.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
let timeToStart = document.querySelector('#timeToStart')
let timeControl = document.querySelector('#timeControl')
let second = 1000
let minute = second * 60
let hour = minute * 60
let day = hour * 24
// اون تاریخی که قراره بهش برسیم
let countDown = new Date('Sep 20, 2025 00:00:00').getTime();
const myRacing = () => {
let nowDate = new Date().getTime(),
distance = countDown - nowDate;
//
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);
// وقتی تاریخ و زمان گذشته بود
if (distance < 0) {
clearInterval(MyTimer);
timeToStart.innerHTML = 'The camp began ☻'
timeControl.innerHTML = ''
}
}
MyTimer = setInterval(myRacing, 1000);