I'm just wondering if anyone can point me in the right direction.
I have an array of events
var event = [
'Event1',
'Event2',
'Event3'
]
As well as a start_date
start_date = '11/10/17'
My goal is to take the current date and find the weekly recurring event for the next few weeks. For example, based on a start_date of 11/10/17 and 3 events, the schedule events would be:
11/10/17 - Event 1
11/17/17 - Event 2
11/24/17 - Event 3
12/1/17 - Event 1
12/8/17 - Event 2
.
.
Let's say it is currently 12/6/17 and I want to display the schedule for the next few weeks my script should output
12/8/17 - Event 2
12/15/17 - Event 3
12/22/17 - Event 1
I figure I would have to take the current date, find the next Friday (since events occur every Friday) as determined by getting the day of startDate, then somehow do some mod math to figure out what event comes next.
This problem is stumping me. Any assistance?