-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcountdown-timer.html
More file actions
94 lines (78 loc) · 2.39 KB
/
countdown-timer.html
File metadata and controls
94 lines (78 loc) · 2.39 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Countdown to Apr 20, 2026 (EST)</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@200..700&display=swap');
.label {
font-family: "Oswald", serif;
font-size: 1.5em;
line-height: 1.1em;
text-transform: uppercase;
letter-spacing: 0.05em;
margin-top: 0;
padding: 5px 10px;
margin-bottom: 15px;
position: relative;color:black;font-weight:bold;
}
.countdown-wrapper {
font-family: "Oswald", serif;
text-align: center;
padding: 24px 32px;
border-radius: 16px;
background: radial-gradient(circle at top, #FC354C, #DC143C 60%);
box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
#countdown {
color:#FFFACD;
font-size: 2.5rem;
font-weight: 700;
letter-spacing: 0.08em;
white-space: nowrap;
}
.note {
font-family: "Oswald", serif;
text-transform: uppercase;
color:#FFFACD;
margin-top: 10px;
font-size: 0.9rem;
}
</style>
</head>
<body>
<div class="countdown-wrapper">
<div class="label">Time Remaining Until</div>
<div class="label">11:59 · Apr 20, 2026 · PST</div>
<div id="countdown">Loading…</div>
<div class="note">(Get my <a href="https://www.amazon.com/dp/B0G3X4LTFR">Kindle ebook</a> free!)</div>
</div>
<script>
// Target date: 23:59 on Apr 20, 2026 EST (UTC-5)
const targetDate = new Date('2026-04-20T04:59:00Z');
function updateCountdown() {
const now = new Date();
const diff = targetDate - now;
const countdownEl = document.getElementById('countdown');
if (diff <= 0) {
countdownEl.textContent = "TIME'S UP!";
return;
}
const totalSeconds = Math.floor(diff / 1000);
const days = Math.floor(totalSeconds / 86400);
const hours = Math.floor((totalSeconds % 86400) / 3600);
const minutes = Math.floor((totalSeconds % 3600) / 60);
const seconds = totalSeconds % 60;
// Only show non-zero units, except always show seconds
const parts = [];
if (days > 0) parts.push(`${days}d`);
if (hours > 0 || days > 0) parts.push(`${hours}h`);
if (minutes > 0 || hours > 0 || days > 0) parts.push(`${minutes}m`);
parts.push(`${seconds}s`);
countdownEl.textContent = parts.join(' ');
}
updateCountdown();
setInterval(updateCountdown, 1000);
</script>
</body>
</html>