-
Notifications
You must be signed in to change notification settings - Fork 243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit schedules by count or by date? #59
Comments
For the date, you can use exceptions - specifically using the unfortunately undocumented
The count is a little trickier, but still doable in the same manner. First, take your base schedule and calculate out the number of desired occurrences. Then just set the last date as the end date like in the previous example.
I haven't tested this so you may need to muck around with it to get your desired results, but that would be the general idea. If you need to do it with English text strings I would capture the schedule first and then ask for the occurrence count separately. |
Does it even make sense to include a count limit as part of the schedule? Schedules are abstracted from specific dates, aren't they? They don't include start and end dates, for example. So I shouldn't impose any kind of limit until calculating dates using a given schedule, at which point I can pass count as a parameter to later.schedule().next(). At that point I presume "count" dates matching the schedule will be returned starting from the time I called next() (or starting from the date I provide as the second parameter to next()). I'm asking this as part of my effort to parse RFC 5545 RRULEs (issue #17.) So I think this is a kind of mismatch between later schedules and RRULEs. It seems to me that COUNT and UNTIL should not be included in the later schedule, rather they should be employed by whatever program is using later, and passed to next() when dates are generated from a schedule, as I suggested above. This is problematic though because the whole idea is to abstract the handling of RRULEs into the later library keeping such details hidden from the user. So now I have a couple thoughts: can I somehow extend later to store COUNT and UNTIL information in a schedule, to be interpreted when later.schedule() is called. The object containing schedules and exceptions could also contain start and end dates, and/or a count. next() could read those values, or have them overwritten with explicit parameters. Or, perhaps iCal RRULEs have no place in the later library, instead later is a dependency of some other library that parses the rules and uses later to generate dates, as part of a greater whole that implements iCal. |
So now I have a couple thoughts: can I somehow extend later to store COUNT and UNTIL information in a schedule, to be interpreted when later.schedule() is called. Sure, the schedule definition is just a simple map. You can add whatever properties you want on to it and then just update
Here are the changes that would need to be made to
|
Is there a way, or may I request support, to limit recurrences by specifying a date on which the recurrence schedule should end, or by specifying that the recurrence only recur a certain number of times?
For example, "every 15 minutes until 2014-12-31" or "every 15 minutes 10 times".
The text was updated successfully, but these errors were encountered: