Untitled

 avatar
unknown
plain_text
a year ago
1.1 kB
5
Indexable
				<div style="text-align: center; padding: 5px 0 10px 0; font-size: 14px;"> Do końca promocji pozostało: <span id="countdown-timer" style="font-weight: bold;">00:00:00</span></div>

					<script>
					  function updateCountdown() {
						const now = new Date();

						const end = new Date(Date.UTC(2024, 3, 17, 21, 59, 59)); // Note: Month is 0-indexed, 2 = March

						const timeLeft = end - now;

						  const hours = Math.floor(timeLeft / (1000 * 60 * 60));
						  const minutes = Math.floor((timeLeft / (1000 * 60)) % 60);
						  const seconds = Math.floor((timeLeft / 1000) % 60);

						  const formattedHours = padWithZero(hours);
						  const formattedMinutes = padWithZero(minutes);
						  const formattedSeconds = padWithZero(seconds);

						  document.getElementById('countdown-timer').innerText = `${formattedHours}:${formattedMinutes}:${formattedSeconds}`;

					  }

					  function padWithZero(number) {
						return number < 10 ? `0${number}` : number.toString();
					  }

					  setInterval(updateCountdown, 1000);
					</script>
Editor is loading...
Leave a Comment