I control a service that has the ability to store Weekday -> Time (also in time.Time format) into a MongoDB for events in a community. The problem I am currently having is trying to rollover these weekdays to the following.
Say every Wednesday at 12:00 there is an event. Once the current weekday is Thursday- I need to roll the time object to the following week at 12:00 Wednesday and store it.
There is no ticking timer. When someone attempts to query all of the current events- I would like for it to check if the event has passed, and if so, update to the next one and display the current. If I was using a persistent timer, the rollover would be easy by just adding 7 days to time.AddDate() or time.Date().
So far I've tried converting the weekday to integers (I'm aware time.Weekday() does this already) then performing math to try to get the amount of days. Then using time.Date() to set the next occurrence. Current: The Go Playground
I have a huge headache and I think I am overthinking and missing something super simple. I've checked the time package documentation and nothing really popped out for me. I'm not worried about printing or storing the data, just getting the proper calculations and manipulating the time package.