const christmas = isItChristmas(); if (christmas) { var head = document.getElementsByTagName('head')[0]; var snowJS = document.createElement("script"); snowJS.type = "text/javascript"; snowJS.src = "./res/js/snowstorm.js"; head.appendChild(snowJS); const profileImage = document.querySelector("img.profile-image"); profileImage.src = "./res/images/profile-christmas.jpg"; } function isItChristmas() { const currentDate = new Date(); const currentYear = currentDate.getFullYear(); const startDate = new Date(`${currentYear}-11-10`); const endDate = new Date(`${currentYear + 1}-03-01`); return currentDate > startDate && currentDate < endDate; }