ice_cube
ice_cube copied to clipboard
Exception rules using .until or .count limiting recurrence rules
Using until or count in exception rules seens to limiting recurrence rules too.
date = Date.new.change({year: 2019})
rrule = IceCube::Schedule.new(date.change({ month: 2, day:1}))
rrule.add_recurrence_rule IceCube::Rule.monthly.day_of_week(:tuesday => [1, -1], :wednesday => [2])
rrule.add_exception_rule IceCube::Rule.monthly.day_of_week(:tuesday => [1]).until( Date.today.change({ month:3, day:1}))
rrule.first(10)
results in
[2019-02-13 00:00:00 -0200, 2019-02-26 00:00:00 -0300]