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 stumbled upon a time zone issue when dealing with Rails TimeWithZone and the occurrence finding methods (e.g. next_occurrence and occurrences_between).
Example: I create a schedule with starting_time in UTC and I'm calling the next_occurrence method with the opening_time argument set to a time in another time zone (e.g. GMT+1). The returned occurrence is not as the doc describes in the starting_time time zone (UTC), but in the time zone I supplied via the argument (GMT+1). More severe is that the time is wrong.
The example below reproduces the problem (ice_cube 0.10.0, Ruby 1.9.3 + Rails 3.2.12)
require'ice_cube'require'active_support/time'require'active_support/core_ext'schedule=IceCube::Schedule.new('2013-03-01 00:00:00 +00:00'.to_time)schedule.add_recurrence_ruleIceCube::Rule.daily# schedule.start_time is 2013-03-01 00:00:00 UTCreference_time=Time.new(2013,3,4).in_time_zone('Bern')# reference_time is Fri, 01 Mar 2013 00:00:00 CET +01:00pschedule.next_occurrence(reference_time)# Tue, 05 Mar 2013 00:00:00 CET +01:00 (wrong time zone, wrong time)pschedule.next_occurrence(reference_time).utc#2013-03-04 23:00:00 UTC (wrong time)pschedule.next_occurrence(reference_time.utc)#2013-03-04 00:00:00 UTC (correct)
My first impression is that the find_occurrences function should make sure that the zones of opening_time and closing_time match the zone of starting_time.
The text was updated successfully, but these errors were encountered:
I stumbled upon a time zone issue when dealing with Rails TimeWithZone and the occurrence finding methods (e.g.
next_occurrence
andoccurrences_between
).Example: I create a schedule with
starting_time
in UTC and I'm calling thenext_occurrence
method with theopening_time
argument set to a time in another time zone (e.g. GMT+1). The returned occurrence is not as the doc describes in thestarting_time
time zone (UTC), but in the time zone I supplied via the argument (GMT+1). More severe is that the time is wrong.The example below reproduces the problem (ice_cube 0.10.0, Ruby 1.9.3 + Rails 3.2.12)
My first impression is that the
find_occurrences
function should make sure that the zones ofopening_time
andclosing_time
match the zone ofstarting_time
.The text was updated successfully, but these errors were encountered: