Removing exceptions
How can I remove an exception that I previously set?
Later schedules are just JSON objects (do a console.log on your schedule to see what it looks like). To remove an exception, just find the one that you want to remove and delete it from the exception list.
Is it possible to implement a schedule.removeException(date) to abstract this and make it part of the library? Dealing with the object itself will cause lots of issues and I'm sure others could benefit from this.
It doesn't make sense to remove exception by passing date. Exceptions aren't dates, occurrences are.
It either boils down to a date, a day, or a time, right?
There are lots of different types of constraints and an exception can be made up of any combination of them. Removing them is basically just doing a filter on the exceptions array to remove the one you want, however the actual filter condition depends on what types of constraints you've used and which exceptions you want to remove. I don't see any way to abstract this in a meaningful way.
@bunkat but just because I add an exception doesn't mean I want to keep it there. We have to be able to cleanly add and remove exceptions. If the exceptions storing is refactored in any way, would it be easier?
One way would be to store a tag along with an exception (such as 'Fridays off') and then be able to remove exceptions using this tag. I don't have any need for this, but it wouldn't be too hard to add if you wanted to implement it for your purposes.
@bunkat open to a PR?
Sure, as long as it has the appropriate test cases with it.