Skip to content

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

Closed

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

  1. changed the title [-]Option to default to prior friday or following when "business weekday only" occurrences fall on a weekend[/-] [+]Option to default to prior friday or following monday when "business weekday only" occurrences fall on a weekend[/+] on May 19, 2016
  2. avit commented on Mar 21, 2017

    @avit
    Collaborator

    Yes this is an interesting scenario. I think this would be covered using the BYSETPOS option being proposed in #289 and #349. I'll try and investigate this further when I have time but do let us know if you have any success trying it with that pull request.

    Closing as a duplicate.

  3. tnypxl commented on Apr 4, 2017

    @tnypxl
    Author

    Thanks @avit!

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