Snjórinn er

fallinn

<script>
    document.addEventListener('DOMContentLoaded', (event) => {
        // Set a fixed end time for the countdown
        const endTime = new Date(2023, 11, 31, 23, 59, 59).getTime(); // Example: December 31, 2023, 23:59:59

        // Function to format number with thousand separator as a dot
        function formatNumber(num) {
            return num.toLocaleString('de-DE', { minimumFractionDigits: 0, maximumFractionDigits: 0 });
        }

        function updateCountdown() {
            // Calculate the current time
            let now = new Date().getTime();

            // Calculate the total duration from now until the end time in minutes
            let totalDurationInMinutes = (endTime - now) / (60 * 1000); // Total duration in minutes

            // Calculate the initial total duration in minutes (9 days)
            let initialTotalDurationInMinutes = 9 * 24 * 60;

            // Calculate the countdown number
            let countdownNumber = 20000 * (totalDurationInMinutes / initialTotalDurationInMinutes);

            // Check if the countdown has reached zero
            if (countdownNumber <= 0) {
                clearInterval(countdownInterval);
                document.getElementById('countdownDisplay').innerText = "Countdown Ended";
            } else {
                // Update the countdown display on the website
                document.getElementById('countdownDisplay').innerText = formatNumber(countdownNumber);
            }
        }

        // Set the interval to check the countdown every minute (60000 milliseconds)
        let countdownInterval = setInterval(updateCountdown, 60000);

        // Initial display update
        updateCountdown();
    });
</script>

Hvað eru margar dósir eftir?

<script>
    document.addEventListener('DOMContentLoaded', (event) => {
        // Set a fixed end time for the countdown
        const endTime = new Date(2023, 11, 31, 23, 59, 59).getTime(); // Example: December 31, 2023, 23:59:59

        // Function to format number with thousand separator as a dot
        function formatNumber(num) {
            return num.toLocaleString('de-DE', { minimumFractionDigits: 0, maximumFractionDigits: 0 });
        }

        function updateCountdown() {
            // Calculate the current time
            let now = new Date().getTime();

            // Calculate the total duration from now until the end time in minutes
            let totalDurationInMinutes = (endTime - now) / (60 * 1000); // Total duration in minutes

            // Calculate the initial total duration in minutes (9 days)
            let initialTotalDurationInMinutes = 9 * 24 * 60;

            // Calculate the countdown number
            let countdownNumber = 20000 * (totalDurationInMinutes / initialTotalDurationInMinutes);

            // Check if the countdown has reached zero
            if (countdownNumber <= 0) {
                clearInterval(countdownInterval);
                document.getElementById('countdownDisplay').innerText = "Countdown Ended";
            } else {
                // Update the countdown display on the website
                document.getElementById('countdownDisplay').innerText = formatNumber(countdownNumber);
            }
        }

        // Set the interval to check the countdown every minute (60000 milliseconds)
        let countdownInterval = setInterval(updateCountdown, 60000);

        // Initial display update
        updateCountdown();
    });
</script>