-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
30 lines (23 loc) · 828 Bytes
/
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
28
29
30
const dayEl = document.getElementById('day');
const hourEl = document.getElementById('hour');
const minuteEl = document.getElementById('minute');
const secondEl = document.getElementById('second');
const Ramadan = new Date('February 28, 2025 04:41:00').getTime();
updateCountdown()
function updateCountdown(){
const now = new Date().getTime();
const gap = Ramadan - now;
const second = 1000;
const minute = second * 60;
const hour = minute * 60;
const day = hour * 24;
const d = Math.floor(gap/day);
const h = Math.floor((gap % day) / hour);
const m = Math.floor((gap % hour) / minute);
const s = Math.floor((gap % minute) / second);
dayEl.innerText = d;
hourEl.innerText = h;
minuteEl.innerText = m;
secondEl.innerText = s;
setTimeout(updateCountdown, 1000)
}