diff --git a/playlist/static/js/countdown.js b/playlist/static/js/countdown.js index 0ba104d..c7306f2 100644 --- a/playlist/static/js/countdown.js +++ b/playlist/static/js/countdown.js @@ -1,3 +1,4 @@ +// Thanks to https://codepen.io/rebelchris/pen/abZRpqM let timer = null; function startCountdown(dateString) { if (timer) clearInterval(timer); @@ -7,7 +8,7 @@ function startCountdown(dateString) { if (dateString == "None") cd.classList.add("hide"); } const end = new Date(dateString).getTime(); - const dayEl = document.getElementById('days'); + const daysEl = document.getElementById('days'); const hoursEl = document.getElementById('hours'); const minutesEl = document.getElementById('minutes'); const secondsEl = document.getElementById('seconds'); @@ -17,7 +18,7 @@ function startCountdown(dateString) { const days = hours * 24; timer = setInterval(updateTime, seconds); function updateTime() { - if (dayEl) { + if (daysEl) { let now = new Date().getTime(); const difference = end - now; @@ -27,7 +28,7 @@ function startCountdown(dateString) { return; } - dayEl.innerText = Math.floor(difference / days); + daysEl.innerText = Math.floor(difference / days); hoursEl.innerText = Math.floor( (difference % days) / hours ); minutesEl.innerText = Math.floor( (difference % hours) / minutes ); secondsEl.innerText = Math.floor( (difference % minutes) / seconds );