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

Should not allow setting both duration and end_time #120

Closed
dlee opened this issue Nov 15, 2012 · 5 comments
Closed

Should not allow setting both duration and end_time #120

dlee opened this issue Nov 15, 2012 · 5 comments

Comments

@dlee
Copy link

dlee commented Nov 15, 2012

Schedule should not allow setting both duration and end_time.

@jfelchner
Copy link

Really? Do you honestly think that this is enough information for anyone to be able to fulfill this issue?

How about an explanation?

I'm going to just guess what you're talking about here: The end_time is not the end time of the occurrence, it's the end time of the schedule. The duration describes how long each occurrence happens for. Hence they are two distinct things.

@dlee
Copy link
Author

dlee commented Nov 20, 2012

@jfelchner end_time should be the end time of first occurrence. If you set both duration and end_time, they are in conflict. Even if end_time was the end time of the schedule (which would be the end time of the last occurrence in the schedule), wouldn't that be in conflict?

@jfelchner
Copy link

@dlee You are correct.

schedule          = IceCube::Schedule.new Time.utc(2012, 10, 1, 12, 0, 0)
schedule.end_time = Time.utc(2012, 12, 1, 12, 0, 0)
schedule.duration = 3600

schedule.to_ical

#=> DTSTART:20121001T120000Z\nDURATION:PT1H\nDTEND:20121201T120000Z

According to the iCal spec, DTEND is the end time of the first occurrence and is what the duration is calculated from:

The "DTSTART" and "DTEND" property pair or "DTSTART" and "DURATION" property pair, specified within the iCalendar object defines the first instance of the recurrence.

Therefore they should be mutually exclusive.

@jfelchner
Copy link

Additionally I feel as though calling Schedule#duration when #end_time has been set, should return the calculated duration rather than returning nil.

@avit
Copy link
Collaborator

avit commented Dec 2, 2012

@dlee it looks like your issues are all follow-ups to the changes introduced in #99. I have some fixes for it in my fork, can we get some consensus on the proposed changes?

  • Should one of end_time= or duration= be deprecated?
  • If we keep both, which one should have precedence?
  • Should to_ical output DTEND or DURATION?

In my current version:

  • Accessors for both are still available.
  • Preference is given to :end_time in options
  • Only DTEND is output to ical, and only :end_time to_hash

avit added a commit to avit/ice_cube that referenced this issue Dec 21, 2012
* schedule.end_time attribute controls duration.
* preference is given to :end_time over :duration for initializing.
* to_ical outputs only DTEND instead of DURATION.
* to_hash outputs only :end_time.

Issue ice-cube-ruby#120
@avit avit closed this as completed Dec 21, 2012
avit added a commit to avit/ice_cube that referenced this issue Dec 21, 2012
* schedule.end_time attribute controls duration.
* preference is given to :end_time over :duration for initializing.
* to_ical outputs only DTEND instead of DURATION.
* to_hash outputs only :end_time.

Issue ice-cube-ruby#120
rlivsey pushed a commit to rlivsey/ice_cube that referenced this issue Jun 18, 2013
* schedule.end_time attribute controls duration.
* preference is given to :end_time over :duration for initializing.
* to_ical outputs only DTEND instead of DURATION.
* to_hash outputs only :end_time.

Issue ice-cube-ruby#120
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