You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed a wrong behavior with just one date. If I set as start_time Date.today.beginning_of_year and I try to get the next yearly (but also monthly) occurrence of 01/29/2013 I don't have 01/01/2014 as result but 01/30/2013.
If I try with start_time = Date.today.beginning_of_year + 1.day it works.
Here below the test to replicate the issue
it'should calculate a current date even on 01/29/2013'doschedule=IceCube::Schedule.new()schedule.add_recurrence_ruleIceCube::Rule.yearlyschedule.start_time=Date.today.beginning_of_yeardate=schedule.next_occurrence(Date.new(2013,1,28))#correctdate.year.should == 2014date.month.should == 1date=schedule.next_occurrence(Date.new(2013,1,30))#correctdate.year.should == 2014date.month.should == 1date=schedule.next_occurrence(Date.new(2013,1,29))#bug: return 01/30/2013date.year.should == 2014date.month.should == 1end
The text was updated successfully, but these errors were encountered:
This was a bit of an edge case when using next_occurrence and the distance from time - start_time (29) would equal days_to_next_month (29) so the step to the next time evaluated to zero.
We actually don't need to consider days_to_next_month unless there's a chance the next month is shorter (e.g. schedule start is on the 28th or after). In all other cases we can safely advance by the number of days in the current month, which avoids the issue.
rlivsey
pushed a commit
to rlivsey/ice_cube
that referenced
this issue
Jun 18, 2013
I've noticed a wrong behavior with just one date. If I set as start_time Date.today.beginning_of_year and I try to get the next yearly (but also monthly) occurrence of 01/29/2013 I don't have 01/01/2014 as result but 01/30/2013.
If I try with start_time = Date.today.beginning_of_year + 1.day it works.
Here below the test to replicate the issue
The text was updated successfully, but these errors were encountered: