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

Add length options for duration #423

Open
avit opened this issue Sep 25, 2017 · 3 comments
Open

Add length options for duration #423

avit opened this issue Sep 25, 2017 · 3 comments
Labels

Comments

@avit
Copy link
Collaborator

avit commented Sep 25, 2017

The RFC allows for specifying length of duration as periods of either:

  • Exact times (hours, minutes, seconds)
  • Nominal times (days, weeks, months)

The length of a day/week/month is changeable, and not supported by IceCube's implementation since it handles everything as an exact number of seconds internally.

Further to this, we may want to deprecate the end_time option in favour of duration, since it would be ambiguous with these options. (It also causes frequent confusion with until.)

@avit avit added the feature label Sep 25, 2017
@seejohnrun
Copy link
Collaborator

Agree with this - end_time always felt a bit weird to me. What do you think the interface should be here for duration being able to take nominal times?

@avit
Copy link
Collaborator Author

avit commented Sep 26, 2017

Well, let's look at the options:

"Numeric" values

schedule.duration = 3600    # SECONDS, unchanged
schedule.duration = 1.month # MONTH if recognizable via ActiveSupport

Hash value

(Seems most obvious)

schedule.duration = {days: 1, hours: 2}

Array

(Not sure if useful)

schedule.duration = [0, 0, 1, 2, 0, 0]  # Same as Time constructor (Y, M, D, H, M, S)

String value

(Maybe only useful for from_ical parsing?)

schedule.duration = "P15DT5H0M20S" # 15 DAY, 5 HOUR, 20 SEC

For reference: iCalendar RFC DURATION

@seejohnrun
Copy link
Collaborator

👍 to Hash syntax above

Also for 'string value' I think that maybe it should have to be wrapped in something like schedule.duration = IcalParser.parse_duration(dur)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants