Search code examples
standardsicalendarrfc5545rrule

iCalendar UNTIL rule must be of the same type as DTSTART property?


In iCalendar RFC 5545, section 3.3.10, I see the following UNTIL parameter description:

The value of the UNTIL rule part MUST have the same value type as the "DTSTART" property. Furthermore, if the "DTSTART" property is specified as a date with local time, then the UNTIL rule part MUST also be specified as a date with local time. If the "DTSTART" property is specified as a date with UTC time or a date with local time and time zone reference, then the UNTIL rule part MUST be specified as a date with UTC time.

However, in 3.8.5.3 Recurrence Rule paragraph, UNTIL is always specified in UTC, regrdless of DTSTART property:

   DTSTART;TZID=America/New_York:19970902T090000
   RRULE:FREQ=DAILY;UNTIL=19971224T000000Z

   DTSTART;TZID=America/New_York:19970902T090000
   RRULE:FREQ=WEEKLY;UNTIL=19971007T000000Z;WKST=SU;BYDAY=TU,TH

There are 5 of such examples in total.

I also found that at least 2 CalDAV clients (iOS and Mozilla Lightning) always submit UNTIL parameter in UTC, regardless of DTSTART property.

The only place where UNTIL must be always in UTC is RRULE in VTIMEZONE. Or am I not getting something?


Solution

  • The cited paragraph has three parts:

    part 1

    The value of the UNTIL rule part MUST have the same value type as the "DTSTART" property.

    This refers to the value type i.e. VALUE=DATE vs. VALUE=DATE-TIME. If the event is an all-day event the UNTIL date has to be specified as an all-day date as well, otherwise the UNTIL date must have a time component.

    part 2

    Furthermore, if the "DTSTART" property is specified as a date with local time, then the UNTIL rule part MUST also be specified as a date with local time.

    In this context "local time" means "floating time" as specified in Section 3.3.5 (Form #1), which says:

    FORM #1: DATE WITH LOCAL TIME

    The date with local time form is simply a DATE-TIME value that does not contain the UTC designator nor does it reference a time zone. For example, the following represents January 18, 1998, at 11 PM:

    19980118T230000

    DATE-TIME values of this type are said to be "floating" and are not bound to any time zone in particular.

    That also includes VALUE=DATE dates.

    If DTSTART is floating, i.e. not anchored in any specific time zone, the UNTIL value can't be an absolute time, otherwise the actual end of the rule would depend on your current time zone.

    As noted, this doesn't apply to RRULEs inside of VTIMEZONE definitions.

    part 3

    If the "DTSTART" property is specified as a date with UTC time or a date with local time and time zone reference, then the UNTIL rule part MUST be specified as a date with UTC time.

    The key difference is that this sentence talks about an absolute DTSTART time, either in UTC or in local time with a time zone reference (like in the quoted examples).

    This refers to Form #2 and Form #3 of Section 3.3.5. If the value of DTSTART corresponds to any of these forms, the UNTIL value has to be specified in UTC time. I think the reasoning behind that is that you don't need to specify a time zone for the UNTIL date if you use "zulu" notation (and you can not assume that you can use the time zone of DTSTART for UNTIL).

    edit

    Since "floating time" is not very common in calendar clients, you'll barely see any non-UTC UNTIL dates. In Thunderbird/Lightning you can explicitly select "Local Time" for an event, which creates a floating event. In that case you should get an UNTIL value in local time as well.