Spaces:
Running
Running
Download script.js from raffnix204/timeless-clock-tower: direct link, hf CLI and curl.
- Browser
- Download file 1.49 kB
-
https://huggingface.co/spaces/raffnix204/timeless-clock-tower/resolve/main/script.js
- Command line
-
hf download hf://spaces/raffnix204/timeless-clock-tower/script.js
-
curl -L -o script.js https://huggingface.co/spaces/raffnix204/timeless-clock-tower/resolve/main/script.js
1.49 kB
| // Set the date we're counting down to (1 week from now) | |
| const countDownDate = new Date(); | |
| countDownDate.setDate(countDownDate.getDate() + 7); | |
| // Update the count down every 1 second | |
| const x = setInterval(function() { | |
| // Get today's date and time | |
| const now = new Date().getTime(); | |
| // Find the distance between now and the count down date | |
| const distance = countDownDate - now; | |
| // Time calculations for days, hours, minutes and seconds | |
| 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); | |
| // Display the result | |
| document.getElementById("days").textContent = days.toString().padStart(2, '0'); | |
| document.getElementById("hours").textContent = hours.toString().padStart(2, '0'); | |
| document.getElementById("minutes").textContent = minutes.toString().padStart(2, '0'); | |
| document.getElementById("seconds").textContent = seconds.toString().padStart(2, '0'); | |
| // If the count down is finished | |
| if (distance < 0) { | |
| clearInterval(x); | |
| document.getElementById("days").textContent = "00"; | |
| document.getElementById("hours").textContent = "00"; | |
| document.getElementById("minutes").textContent = "00"; | |
| document.getElementById("seconds").textContent = "00"; | |
| } | |
| }, 1000); |