schedule_attributes icon indicating copy to clipboard operation
schedule_attributes copied to clipboard

Change yearly ranges to serialize as RRULE

Open avit opened this issue 8 years ago • 1 comments

EXRULE has long been deprecated in iCalendar RFC and IceCube.

Currently the rules that set up start_day_of_month and end_day_of_month are done using a mask over the start_month and end_month inputs as EXRULEs. This no longer gets serialized with the current version of IceCube.

We would need to change serialization to define everything as RRULEs. For example:

# Jan 15 to Apr 15, every year
params = {start_month: 1, start_day_of_month: 15, end_month: 4, end_day_of_month: 15}
schedule.rrules = [
  Rule.daily.month(1).day_of_month(*15..31),
  Rule.daily.month(2, 3),
  Rule.daily.month(4).day_of_month(*1..15)
]

This will make it more complicated to read back the rules into a params hash. We will have to be mindful of edge-cases such as:

# Dec 15 to Jan 15, every year
params = {start_month: 12, start_day_of_month: 15, end_month: 1, end_day_of_month: 15}
schedule.rrules = [
  Rule.daily.month(12).day_of_month(*15..31),
  Rule.daily.month(1).day_of_month(*1..15)
]

avit avatar Jan 18 '17 16:01 avit

Related to https://github.com/seejohnrun/ice_cube/issues/131 and https://github.com/seejohnrun/ice_cube/issues/127

avit avatar Jan 18 '17 16:01 avit