-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated with descriptions and added a countdown and a map
- Loading branch information
1 parent
a57e121
commit b4e76f8
Showing
2 changed files
with
63 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Set the target date | ||
const targetDate = new Date("December 11, 2024 18:00:00").getTime(); | ||
|
||
// Update the countdown every second | ||
const countdown = setInterval(() => { | ||
const now = new Date().getTime(); | ||
const timeLeft = targetDate - now; | ||
|
||
// Calculate days, hours, minutes, and seconds | ||
const days = Math.floor(timeLeft / (1000 * 60 * 60 * 24)); | ||
const hours = Math.floor((timeLeft % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); | ||
const minutes = Math.floor((timeLeft % (1000 * 60 * 60)) / (1000 * 60)); | ||
const seconds = Math.floor((timeLeft % (1000 * 60)) / 1000); | ||
|
||
// Update the display | ||
const countdownElement = document.getElementById("countdown"); | ||
|
||
if (timeLeft > 0) { | ||
if (days > 0) { | ||
countdownElement.textContent = `${days} day${days > 1 ? "s" : ""} to go!`; | ||
} else { | ||
countdownElement.textContent = `${hours} hour${hours !== 1 ? "s" : ""}, ${minutes} minute${minutes !== 1 ? "s" : ""}, and ${seconds} second${seconds !== 1 ? "s" : ""} to go!`; | ||
} | ||
} else { | ||
clearInterval(countdown); | ||
countdownElement.textContent = "Event Started!"; | ||
} | ||
}, 1000); |