Hey there! I'm currently working on a Virtual Tour Software project using Javascript, and I have a specific requirement. I need to create an action that opens a URL (containing a photo panorama) only during a particular time frame - specifically, the first Friday of every month between 8am and 10am. Any suggestions on how to achieve this? Thanks a lot, Michal
Here's what I have come up with so far:
var startDate = new Date('Jun 5, 2020 8:00:00').getTime();
var endDate = new Date('Jun 5, 2020 10:00:00').getTime();
setInterval(function() {
var now = new Date().getTime();
var isVisible = now > startDate && now < endDate;
var hotspot = this.getPanoramaOverlayByName(this.getMediaByName('Panorama'), 'Hotspot');
if(hotspot && hotspot.get('enabled') != isVisible)
hotspot.set('enabled', isVisible);
}.bind(this), 1000);`
The issue I am facing is that I have to manually update the "startDate" and "endDate" variables each time. I am looking for a way to automate this process so that it is visible on every First Friday of the month.