avit
Joined 9/2/2017
avit said over 7 years ago on Recurring Events with ice_cube :

Although it's possible to use IceCube with Date instances like you've shown when selecting the "start" and "end" dates, IceCube actually works with exact Time objects and will convert it for you internally. You can see this in the occurrence output, where it defaults to 00:00 of your local system time zone. (This might turn out to be UTC on your server, and different from your workstation, or it could be affected by the current `Time.zone` setting in Rails... it might be what you expect, or maybe not. Just be aware.)

If you're thinking of using the schedules for anything like reminders, you will have more accurate results if you build your schedule with an actual Time object instead of a Date. When using Rails, you can get a local time (TimeWithZone) for any zone like this:

# Get a zone instance, (or else set it globally via Time.zone):
zone = ActiveSupport::TimeZone["America/New_York"]

# Get any time in that zone, or parse from a string:
now = zone.local(2017, 9, 1, 12, 0, 0)
now = zone.parse("2017-09-01 12:00:00")

# Then use it with the schedule:
schedule = IceCube::Schedule.new(now)

IceCube will then correctly handle things like Daylight Saving Time changes.