Network Working Group | C. Daboo |
Internet-Draft | Apple Inc. |
Updates: 5545 (if approved) | G. Yakushev |
Intended status: Standards Track | Google Inc. |
Expires: January 16, 2014 | July 15, 2013 |
Non-Gregorian Recurrence Rules in iCalendar
draft-daboo-icalendar-rscale-01
This document defines how non-Gregorian recurrence rules can be specified in iCalendar data.
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on January 16, 2014.
Copyright (c) 2013 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
The iCalendar [RFC5545] data format is in widespread use to represent calendar data. iCalendar represents dates and times using the Gregorian calendar system only. It does provide a way to use non-Gregorian calendar systems via a "CALSCALE" property, however this has never been formally used. However, there is a need to support at least non-Gregorian recurrence patterns to cover anniversaries, and many local, religious, or civil holidays based on non-Gregorian dates.
There are several disadvantages to using the existing "CALSCALE" property in iCalendar for implementing non-Gregorian calendars:
This specification solves these issues by allowing the "CALSCALE" to remain set to Gregorian, but re-defining the recurrence rule property "RRULE" to accept new items including one that allows non-Gregorian calendar systems to be used. With this, all the date, time and period values in the iCalendar object would remain specified using the Gregorian calendar system, but repeating patterns in other calendar systems could be defined. It is then up to calendar user agents and servers to map between Gregorian and non-Gregorian calendar systems in order to expand out recurrence instances.
This specification does not itself define calendar systems, rather it utilizes the registry defined by the Unicode Consortium (http://unicode.org) in their CLDR (Common Locale Data Repository) project.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].
The notation used in this memo is the ABNF notation of [RFC5234] as used by iCalendar [RFC5545]. Any syntax elements shown below that are not explicitly defined in this specification come from iCalendar [RFC5545].
When a Gregorian calendar date value is shown in text, it will use the format "YYYYMMHH", where "YYYY" is the 4-digit year, "MM" the 2-digit month, and "DD" the 2-digit day (this is the same format used in iCalendar [RFC5545]). The Chinese calendar will be used as an example of a non-Gregorian calendar for illustrative purposes. When a Chinese calendar date value is shown in text, it will use the format "{C}YYYYMM[L]DD" - i.e., the same format as Gregorian but with a "{C}" prefix, and an optional "L" character after the month element to indicate a leap month. Similarly, {I} and {H} are used in other examples as prefixes for Islamic and Hebrew dates, respectively.
In the Gregorian calendar system, each year is composed of a fixed number of months (12), with each month having a fixed number of days (between 30 and 31), except for the second month (February) which contains either 28 days, or 29 days (in a leap year). Weeks are composed of 7 days, with day names Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday. Years can have either 365 or 366 days (the later in a leap year). The number of whole weeks in a year is 52.
In iCalendar, the "RECUR" value type defines various fields used to express a recurrence pattern, and those fields are given limits based on those of the Gregorian calendar system. Since other calendar systems can have different limits and other behaviors that need to be accounted for, the maximum values for the elements in the "RECUR" value are not covered by this specification.
To generate a set of recurring instances in a non-Gregorian calendar system, the following procedure is used:
When generating instances, the following procedure might be used:
DTSTART;VALUE=DATE:20130210 RRULE:RSCALE=CHINESE;FREQ=YEARLY SUMMARY:Chinese New Year
Consider the following example for an event representing the Chinese New Year:
This specification makes use of calendar algorithms defined by the Unicode Consortium [TBD - reference]. The definition of different calendar scales is defined by Unicode, as per Section 5.
This specification extends the existing "RRULE" iCalendar property value to include a new "RSCALE" element that can be used to indicate the calendar system used for generating the recurrence pattern.
When "RSCALE" is present, the other changes to "RRULE" are:
recur-rule-part /= ("RSCALE" "=" rscale) / ("SKIP" "=" skip) rscale = (iana-token ; A CLDR-registered calendar system ; name. / x-name) ; A non-standard, experimental ; calendar system name. skip = ("YES" / "BACKWARD" / "FORWARD") ; When "RSCALE" is not present the default ; is "YES". When "RSCALE" is present the default ; is "BACKWARD". monthnum = [plus / minus] 1*2DIGIT ["L"] ; Existing element modified to include a positive ; or negative offset capability, as well as a leap ; month indicator suffix.
The syntax for the "RECUR" value is modified in the following fashion:
Leap months can occur in different calendar systems. For most of those, the suffix "L" is added to the "RRULE" month number component to indicate a leap month. In some cases the month precedes the regular month with the same number, in other cases it follows. The one exception to this rule is the Hebrew calendar, where we follow the definition from Unicode [TBD - REF]. In that case months are number 1 through 13, with month 6 being the leap month. Thus in non-leap years, month 6 is skipped.
DTSTART;VALUE=DATE:20130210 RRULE:RSCALE=CHINESE;FREQ=YEARLY SUMMARY:Chinese New Year
Consider the following set of iCalendar properties:
The Chinese date corresponding to the first instance is {C}47110101. The table below shows the initial instance, and the next four, each of which is determined by adding the appropriate amount to the year component of the Chinese date. Also shown is the conversion back to the Gregorian date:
Chinese Date | Gregorian Date |
---|---|
{C}47110101 | 20130210 - DTSTART specified in iCalendar data |
{C}47120101 | 20140131 |
{C}47130101 | 20150120 |
{C}47140101 | 20160208 |
{C}47150101 | 20170128 |
DTSTART;VALUE=DATE:20130709 RRULE:RSCALE=ISLAMIC;FREQ=YEARLY;BYMONTH=9 SUMMARY:Start of Ramadan
Consider the following set of iCalendar properties:
The Islamic date corresponding to the first instance is {I}14340901. The table below shows the initial instance, and the next four, each of which is determined by adding the appropriate amount to the year component of the Islamic date. Also shown is the conversion back to the Gregorian date:
Islamic Date | Gregorian Date |
---|---|
{I}14340901 | 20130709 - DTSTART specified in iCalendar data |
{I}14350901 | 20140628 |
{I}14360901 | 20150618 |
{I}14370901 | 20160606 |
{I}14380901 | 20170527 |
Note that in this example, the value of the "BYMONTH" component in the "RRULE" matches the Islamic month value and not the Gregorian month.
DTSTART;VALUE=DATE:20140208 RRULE:RSCALE=HEBREW;FREQ=YEARLY;BYMONTH=6;BYMONTHDAY=8;SKIP=FORWARD SUMMARY:Anniversary
Consider the following set of iCalendar properties:
The Hebrew date corresponding to the first instance is {H}57740608, note that month 6 is a leap month in year 5774. The table below shows the initial instance, and the next four, each of which is determined by adding the appropriate amount to the year component of the Hebrew date, taking into account that only year 5776 is a leap year. Thus in other years the Hebrew month component is adjusted forward to month 7. Also shown is the conversion back to the Gregorian date:
Hebrew Date | Gregorian Date |
---|---|
{H}57740608 | 20140208 - DTSTART specified in iCalendar data |
{H}57750708 | 20150227 |
{H}57760608 | 20160217 |
{H}57770708 | 20170306 |
{H}57780708 | 20180223 |
This specification uses the Unicode Consortium's registry of calendar systems to define valid values for the "RSCALE" element of an "RRULE" [TBD - Unicode BCP47 - http://unicode.org/repos/cldr/trunk/common/bcp47/calendar.xml]. Note that the underscore character "_" is never used in CLDR-based calendar system names. New values can be added to this registry following Unicode Consortium rules. It is expected that many implementations of non-Gregorian calendars will use software libraries provided by Unicode (ICU), and hence it makes sense to re-use their registry rather than creating a new one. For consistency, when used, the "RSCALE" values SHOULD be uppercased.
This specification does not introduce any addition security concerns beyond those described in [RFC5545].
This specification does not define any new IANA registries or values.
Thanks to the following for feedback: Mark Davis, Mike Douglass, Peter Edberg, Arnaud Quillaud, and Dave Thewlis. This specification came about via discussions at the Calendaring and Scheduling Consortium.
[RFC2119] | Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. |
[RFC5234] | Crocker, D. and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", STD 68, RFC 5234, January 2008. |
[RFC5545] | Desruisseaux, B., "Internet Calendaring and Scheduling Core Object Specification (iCalendar)", RFC 5545, September 2009. |
Changes in -01: