From 0215cbc844fd42357e18634df79e6a04e8ce6ac0 Mon Sep 17 00:00:00 2001 From: Sam <74021826+x39OME@users.noreply.github.com> Date: Wed, 15 Feb 2023 11:12:56 +0300 Subject: [PATCH] Update main.js --- js/main.js | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/js/main.js b/js/main.js index 36c42c1..a1a9f22 100644 --- a/js/main.js +++ b/js/main.js @@ -7,27 +7,27 @@ function menuToggle(){ }; // Countdown Done !! -// const body = document.body; -// const endTime = new Date('9 16 2022 23:59:59'); -// const daysEl = document.getElementById('days'); -// const hoursEl = document.getElementById('hours'); -// const minutesEl = document.getElementById('minutes'); -// const secondsEl = document.getElementById('seconds'); +const body = document.body; +const endTime = new Date('2 21 2023 23:59:59'); +const daysEl = document.getElementById('days'); +const hoursEl = document.getElementById('hours'); +const minutesEl = document.getElementById('minutes'); +const secondsEl = document.getElementById('seconds'); -// setInterval(updateCountdown, 1000) +setInterval(updateCountdown, 1000) -// function updateCountdown() { -// const startTime = new Date(); -// const diff = endTime - startTime; -// const days = Math.floor(diff / 1000 / 60 / 60 / 24); -// const hours = Math.floor(diff / 1000 / 60 / 60) % 24; -// const minutes = Math.floor(diff / 1000 / 60) % 60; -// const seconds = Math.floor(diff / 1000) % 60; -// daysEl.innerHTML = days; -// hoursEl.innerHTML = hours < 10 ? '0'+hours : hours; -// minutesEl.innerHTML = minutes < 10 ? '0'+minutes : minutes; -// secondsEl.innerHTML = seconds < 10 ? '0'+seconds : seconds; -// }; +function updateCountdown() { + const startTime = new Date(); + const diff = endTime - startTime; + const days = Math.floor(diff / 1000 / 60 / 60 / 24); + const hours = Math.floor(diff / 1000 / 60 / 60) % 24; + const minutes = Math.floor(diff / 1000 / 60) % 60; + const seconds = Math.floor(diff / 1000) % 60; + daysEl.innerHTML = days; + hoursEl.innerHTML = hours < 10 ? '0'+hours : hours; + minutesEl.innerHTML = minutes < 10 ? '0'+minutes : minutes; + secondsEl.innerHTML = seconds < 10 ? '0'+seconds : seconds; +}; // Time & Date (Footer) setInterval(function(){