Add length options for duration
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.)
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?
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
👍 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)