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

Occurrences between breaks on the first exception #82

Closed
jvenki opened this issue May 21, 2012 · 0 comments
Closed

Occurrences between breaks on the first exception #82

jvenki opened this issue May 21, 2012 · 0 comments

Comments

@jvenki
Copy link

jvenki commented May 21, 2012

Suppose I have a Daily rule which occurs on all days except one day of a week and I invoke occurrences_between, the returned dates are only those till we have the exempted DAY.

require 'rubygems'
require 'ice_cube'
require 'active_support/all'
require 'pp'
include IceCube

schedule = Schedule.new(DateTime.new(2012, 05, 1))
schedule.add_recurrence_rule Rule.daily.day(:sunday, :tuesday, :wednesday, :thursday, :friday, :saturday)
occurrences = schedule.occurrences_between(DateTime.new(2012, 05, 19), DateTime.new(2012, 05, 24))
occurrences.each do |o|
    puts 'Occurring on ' + o.to_s 
end

The expected output is 19th May, 20th, 22nd, 23rd and 24th. But the actual output is only 19th and 20th. Since 21st is not allowed, the logic inside 'find_occurrences' of schedule.rb will break upon the 'res' being NULL.

For the same reason, invoking schedule.next_occurrence('20th May') will return year 2248 rather than 22nd May.

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