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

Schedule#end_time (DTEND) should define the time when an event ends, not its recurrence #99

Closed
reedlaw opened this issue Oct 4, 2012 · 3 comments

Comments

@reedlaw
Copy link
Contributor

reedlaw commented Oct 4, 2012

Before creating a pull request for this I want to confirm that my understanding of the RFC is correct. When creating a recurring event, the start_time and end_time of an instance of IceCube::Schedule refer to DTSTART and DTEND respectively. According to the spec, these properties refer to the event. A recurrence rule's last recurrence can be specified by UNTIL. IceCube correctly creates the event and recurrence rule with the following example:

irb(main):001:0> start_time = Time.new(2012,10,4) + 9 * 60 * 60
irb(main):002:0> end_time = Time.new(2012,10,4) + 17 * 60 * 60
irb(main):003:0> schedule = IceCube::Schedule.new(start_time, end_time: end_time)
irb(main):005:0> schedule.add_recurrence_rule IceCube::Rule.daily.until(Time.new(2012,10,7))

schedule.to_ical correctly outputs

DTSTART;TZID=CST:20121004T090000
RRULE:FREQ=DAILY;UNTIL=20121006T160000Z
DTEND;TZID=CST:20121004T170000

But the occurrences are incorrect:

irb(main):006:0> schedule.all_occurrences
=> [2012-10-04 09:00:00 +0800]

The event lasts from 9AM to 5PM (according to DTSTART and DTEND) and should repeat until 3 days from now (according to UNTIL). But IceCube only shows one occurrence, presumably because it follows the date in DTEND rather than UNTIL.

The correct behavior would be to return the following:

irb(main):006:0> schedule.all_occurrences
=> [2012-10-04 09:00:00 +0800, 2012-10-05 09:00:00 +0800, 2012-10-06 09:00:00 +0800]

I have confirmed that this is the correct behavior in both Google Calendar and Mozilla Thunderbird (with the Lightning calendar plugin) by creating a recurring event and exporting/importing it. The above schedule.to_ical generated iCalender event is correctly recognized by both Google Calender and Mozilla Thunderbird.

@mhenrixon
Copy link

That's one of the problems we have been having! Very nice and a big thanks, any chance this can be merged in pretty quickly and a new version released?

@seejohnrun
Copy link
Collaborator

This is exceptional - thank you. I'll merge it in and it will go out with a minor version release by tonight

@seejohnrun
Copy link
Collaborator

I'll also be removing end_time from #to_s, as its meaning is no longer relevant the way its used there. It will remain in the serialization functions and in #to_ical.

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

3 participants