Open c0dezli opened 7 years ago
This is a great idea, but implementing repeating events would require a big refactor and not something I have planned for now.
Implementing repeating events can be tricky without knowing how it's going to be used. Does the user need an array of every date the event will repeat on, or just another key in the Sherlock object like repeat: "weekly", end_repeat: "5/7/2017"
? There are also lot of edge cases to repeating events, like how does "Exam on Jan 30, repeat every month" behave in February?
It may work well if you returned the extracted operator 9first/last/next/previous/every/alternate/everyother/everysecond/everythird/everyfourth.../) and the date range array For edge cases you could allow for the provision of a callback function on the date range array. If the operator creates a repeat that has no end date then return the operator and the next occurrence only. It would be down to the individual developer to then handle the data accordingly (use, store or refactor)
if I was handling a "repeat every other Thursday" without an end date, as a developer I'd know how long I needed to "trust" that data for before needing to re calculate it. I'd store that data in a way that mean's I will probably just need it for the session tbh.
You could map this to the iCal rrule format
This project has an input interpreter https://jakubroztocil.github.io/rrule/
Here is the json iCal rfc https://tools.ietf.org/html/rfc7265
Is it possible to add repeating events like "Homework due Tuesday 12:00pm every week until May 7"?