Skip to content

Option to default to prior friday or following monday when "business weekday only" occurrences fall on a weekend #338

Description

@tnypxl

This is a bit of an edge case and I'm not sure how to account for it given ice_cube's current state.

schedule = IceCube::Schedule.new(t0 = Time.local(2016, 5, 1))
schedule.add_recurrence_rule IceCube::Rule.monthly.day_of_month(15, -1).day(:monday, :tuesday, :wednesday, :thursday, :friday)
schedule.first(2).each { |occurrence| p occurrence.strftime('%A') }

The output:

"Tuesday"
"Wednesday"
 => [2016-05-31 00:00:00 -0500, 2016-06-15 00:00:00 -0500] 

The current behavior skips any occurrence that falls on a weekend. This is expected. But would it be valuable to allow fallback occurrence rules? Maybe I would pass an existing occurrence to a fallback rule and add occurrences accordingly...

Thoughts?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions