Skip to content

[bug] iCal string incorrectly handling timezones #568

@sergioisidoro

Description

@sergioisidoro

I had an issue where all dates were off by 3 hours (our current offset to UTC).
I went down a rabbit whole. It seems the iCal timezones are not correctly perserved

Here's a reproduction:

> schedule = IceCube::Schedule.new(Time.current)
{
    :start_time => {
        :time => 2025-06-17 15:06:35.246698923 UTC, # ✅
        :zone => "Europe/Helsinki"# ✅ 
         ...
}
> # add rules and stuff
> ical_string = schedule.to_ical
"DTSTART;TZID=EEST:20250617T180635.... 

> ice_cube = IceCube::Schedule.from_ical(ical_string)
{
    :start_time => 2025-06-17 18:06:35 +0000,  # ❌  (timezone lost, time offeset, and time in UTC)
    ...
}

Note how we went from 15:06:35 UTC to 18:06:35 UTC upon doing an iCal roundtrip, meaning we lost 3h in the roundtrip.

Similar issues:
#439
#382

I wonder if the repo would be open to some overall breaking changes in this behaviour to be up to spec. Perhaps adopting icalendar gem as been proposed? -- https://github.com/icalendar/icalendar

Edit: corrected the issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions