// Functie om automatisch de huidige datum te tonen function updateDates() { const today = new Date(); const options = { day: 'numeric', month: 'long', year: 'numeric' }; const dutchDate = today.toLocaleDateString('nl-NL', options); // Update de laatste update datum in de footer const footerDate = document.querySelector('.clicked-element'); if (footerDate) { footerDate.innerHTML = `Laatste update: ${dutchDate} | Meer dan 15.000 ECU foutcodes in onze database`; } // Update de badge datum bovenaan de pagina const headerBadge = document.querySelector('[class*="animate-bounce"]'); if (headerBadge) { // Extract day and month for the badge const day = today.getDate(); const monthNames = ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december']; const month = monthNames[today.getMonth()]; const year = today.getFullYear(); headerBadge.textContent = `✅ LAATST BIJGEWERKT: ${day} ${month.toUpperCase()} ${year}`; } } // Export functions for the website system export function init() { // Update dates when page loads updateDates(); // Update dates daily (check every hour and update if date changed) const dateUpdateInterval = setInterval(() => { updateDates(); }, 3600000); // Check every hour (3600000 ms = 1 hour) // Store the interval ID globally so it can be cleared in teardown window.dateUpdateInterval = dateUpdateInterval; } export function teardown() { // Clear the interval when page is unloaded if (window.dateUpdateInterval) { clearInterval(window.dateUpdateInterval); delete window.dateUpdateInterval; } }