-
Notifications
You must be signed in to change notification settings - Fork 362
Open
Labels
Description
From RFC2445:
The BYSETPOS rule part specifies a COMMA character (US-ASCII decimal
44) separated list of values which corresponds to the nth occurrence
within the set of events specified by the rule. Valid values are 1 to
366 or -366 to -1. It MUST only be used in conjunction with another
BYxxx rule part. For example "the last work day of the month" could
be represented as:
RRULE:FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1
Each BYSETPOS value can include a positive (+n) or negative (-n)
integer. If present, this indicates the nth occurrence of the
specific occurrence within the set of events specified by the rule.
I don't think IceCube supports this right now. It would allow creating rules like the above "last work day of the month". Some ways to emulate this particular case are (as recurrence rules for Sidetiq jobs):
monthly.day_of_month(-1, -2, -3)
and when ran, checking today's weekday- same, but excluding
daily.day(:saturday, :sunday)
. Not much better, can still occur more then once a month, when none of the last three days fall on a weekend.
Calling that hypothetical new rule indexed
for now, one could write monthly.day(:monday, :tuesday, :wednesday, :thursday, :friday).indexed(-1)
. That rule would first evaluate to all weekdays in a month, and then restricted to the last one, whichever weekday that would be.