Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
tnypxl opened this issue May 19, 2016 · 2 comments

Comments

@tnypxl
Copy link

tnypxl commented May 19, 2016

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?

@tnypxl tnypxl 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 May 19, 2016
@avit
Copy link
Collaborator

avit commented Mar 21, 2017

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.

@avit avit closed this as completed Mar 21, 2017
@tnypxl
Copy link
Author

tnypxl commented Apr 4, 2017

Thanks @avit!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants