I would like to show and hide an element based on time of year, For example a button that will only show on the page from November 1 to March 31. But i have no idea how to do this and i haven't been able to find any examples of this online. The closest i have found was a countdown timer but i don't know how to modify it to do what i am trying to do. Hre is the countdown code if that would help someone with what i am trying to do.
$w.onReady(function () { var countDownDate = new Date("Dec 1, 2018 20:11:25").getTime(); // Countdown date and time var x = setInterval(function() { var now = new Date().getTime(); var distance = countDownDate - now; var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); $w("#countDownTimer").text = days + "d " + hours + "h " + minutes + "m " + seconds + "s "; if (distance < 0) { clearInterval(x); $w("#countDownTimer").text = "EXPIRED"; } }, 1000); });
This feature was fantastic! Although I wish Wix had the option to schedule a candidate site to go public on a specific date, this capability provided here works wonderfully as an alternative. I truly appreciate this code and the invaluable assistance of Chat GPT in enhancing its capabilities. THANKS!