// Privacy Policy Page - Dynamic Date Updates let privacyPageListeners = []; // Function to format date in Spanish function formatDateSpanish(date) { const months = [ 'enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre' ]; const day = date.getDate(); const month = months[date.getMonth()]; const year = date.getFullYear(); return `${day} de ${month} de ${year}`; } // Function to update date dynamically function updateDynamicDates() { const currentDate = new Date(); const formattedDate = formatDateSpanish(currentDate); // Update header date badge const headerDateElement = document.querySelector('[data-dynamic-date="header"]'); if (headerDateElement) { headerDateElement.textContent = `Última actualización: ${formattedDate}`; } // Update final section date const finalDateElement = document.querySelector('[data-dynamic-date="final"]'); if (finalDateElement) { finalDateElement.innerHTML = `${formattedDate}`; } console.log(`Privacy Policy dates updated to: ${formattedDate}`); } // Initialize dynamic date functionality function init() { // Update dates on page load updateDynamicDates(); // Optional: Update dates every minute (uncomment if needed for real-time updates) // const dateUpdateInterval = setInterval(updateDynamicDates, 60000); // privacyPageListeners.push({ type: 'interval', id: dateUpdateInterval }); console.log('Privacy Policy dynamic dates initialized'); } // Cleanup function function teardown() { // Clean up any intervals or listeners privacyPageListeners.forEach(listener => { if (listener.type === 'interval') { clearInterval(listener.id); } }); privacyPageListeners = []; console.log('Privacy Policy dynamic dates cleaned up'); } // Export functions for the page system export { init, teardown };