Clean up JS a little before the D.I.E. date

This commit is contained in:
swaggboi 2021-08-12 11:56:42 -04:00
parent 202094b660
commit d142a26e1f

View File

@ -30,25 +30,27 @@ var countDownDate = new Date("Aug 17, 2021 00:00:00").getTime();
// Update the count down every 1 second
var x = setInterval(function () {
// Get today's date and time
var now = new Date().getTime();
// Get today's date and time
var now = new Date().getTime();
// Find the distance between now and the count down date
var distance = countDownDate - now;
// Find the distance between now and the count down date
var distance = countDownDate - now;
// Time calculations for days, hours, minutes and seconds
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Time calculations for days, hours, minutes and seconds
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) /
(1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Display the result in the element with id="dethKlok"
document.getElementById("dethKlok").innerHTML = days + "d " + hours + "h " +
minutes + "m " + seconds + "s ";
// Display the result in the element with id="dethKlok"
document.getElementById("dethKlok").innerHTML = days + "d " + hours + "h " +
minutes + "m " + seconds + "s ";
// If the count down is finished, write some text
if (distance < 0) {
clearInterval(x);
document.getElementById("dethKlok").innerHTML = "DONE. Rest in pieces";
}
// If the count down is finished, write some text
if (distance < 0) {
clearInterval(x);
document.getElementById("dethKlok").innerHTML =
"DONE. Deprecated as of Aug 17, 2021 💀";
}
}, 1000);