Published

CalConnect Standard

CC 18012:2018
Date and time — General recurrence representation
TC VCARD, CALENDAR
CalConnect Standard

 


 



Foreword

The Calendaring and Scheduling Consortium (“CalConnect”) is global non-profit organization with the aim to facilitate interoperability of technologies across user-centric systems and applications.

CalConnect works closely with liaison partners including international organizations such as ISO, OASIS and M3AAWG.

The procedures used to develop this document and those intended for its further maintenance are described in the CalConnect Directives.

In particular the different approval criteria needed for the different types of CalConnect documents should be noted. This document was drafted in accordance with the editorial rules of the CalConnect Directives.

Attention is drawn to the possibility that some of the elements of this document may be the subject of patent rights. CalConnect shall not be held responsible for identifying any or all such patent rights. Details of any patent rights identified during the development of the document will be in the Introduction and/or on the CalConnect list of patent declarations received (see www.calconnect.com/patents).

Any trade name used in this document is information given for the convenience of users and does not constitute an endorsement.

This document was prepared by Technical Committee VCARD, CALENDAR.

== Introduction

The iCalendar standard (RFC 5545) has defined the de-facto standard for specifying recurring time intervals.

However, its syntax is tightly bound to the syntax and assumptions of RFC 5545, requiring a data model representation that assumes a hierarchy of properties, parameters and data types that are not necessarily provided in other date and time representations, such as the International Standard for date and time representation, ISO 8601:2004.

RFC 5545 also relies on a number of indirect data inheritance rules that are not clearly specified and therefore not easily reproduced in other representations outside of iCalendar.

This document describes a method to specify recurring time intervals with repeat rules in representation in line with those of the time scale components and date and time representations described in ISO 8601:2004.

Date and time — General recurrence representation

1.  Scope

The purpose of this document is to provide a generalized representation of selection rules and recurring time intervals with repeat rules in line with those of the time scale components and date and time representations described in ISO 8601-1:--.

Representations in this document describe a superset of recurrence rules to “RECUR” rules in RFC 5545, but aims to maintain compatibility with it inasmuch possible.

This document only supports date elements from the Gregorian calendar and times from the 24-hour clock.

Date and time format representations described in this document utilizes numbers, alphabets and symbols defined in ISO/IEC 646 (all parts). These representations are meant to be both human recognizable and machine readable. Character encoding of the representations is not covered in this document.

2.  Normative references

The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.

CC CC 18011:—, 1, Date and time — Explicit representation

ISO 8601-1:—, Date and time — Representation for information interchange — Part 1: Basic rules

3.  Terms, definitions, symbols and abbreviated terms

For the purposes of this document, the terms and definitions given in CC CC 18011:— and the following apply.

3.1.  Terms and definitions

3.1.1. 

repeat rule

consists of a set of eligible time intervals (Clause 3.1.4) and selection rules (Clause 3.1.2) that allows computation of a set of matching instants (Clause 3.1.5)

3.1.2. 

selection rule

rule specifying restrictions on the value of a time scale component (ISO 8601-1:--, Clause 3.1.3.9)

3.1.3. 

repeat cycle

set of repeating instants (ISO 8601-1:--, Clause 3.1.1.2), calculated by a specified start instant and specified duration (ISO 8601-1:--, Clause 3.1.1.6) gap between the repeating instants

3.1.4. 

eligible time interval

time interval (ISO 8601-1:--, Clause 3.1.1.3) eligible for matching using selection rules (Clause 3.1.2)

3.1.5. 

matching instants

set of instants (ISO 8601-1:--), computed by a repeating rule (Clause 3.1.1), that belongs within eligible time intervals (Clause 3.1.4) and fulfills criteria set by specified selection rules (Clause 3.1.2)

3.1.6. 

movable day

repeatedly occurring day in a calendar that is represented by criteria set by one or more selection rules (Clause 3.1.2), but does not always resolve to a fixed calendar day in every repeating cycle (Clause 3.1.3)

Note 1 to entry: The selection of this term pays homage to the phrase “movable feast” used in some calendars to indicate the rule-based determination of annual events.

EXAMPLE 1

Thanksgiving Day in the U.S. and Canada, are considered movable days, set to the fourth Thursday in November and the second Monday in October, respectively.

EXAMPLE 2

First Day of Summer (sumardagurinn fyrsti) in Iceland is considered a movable day, set to the first Thursday after April 18th.

EXAMPLE 3

Father’s Day is celebrated on the third Sunday in June in North America and is considered a movable day.

3.2.  Symbols

3.2.1.  General

Representations specified in this document make use of symbols given in CC 18011:-- and the following.

3.2.2.  Composite component symbols

selection

representation for a set of selection rules as determined in Clause 5.1

3.2.3.  Symbols used in place of digits or signs

These symbols are used to represent characters in the date and time representations. They are used in representations only, and are replaced by one or more characters, as described, in expressions:

!

indicates that the token following this symbol is optional (may be omitted)

n

a positive integer or value, may be left absent to signify an unbounded value

i

a positive integer

3.2.4.  Designator symbols

These symbols are used to represent designators in the date and time expressions:

“F”

the frequency designator, represented by the character “F”, preceding the component which represents the frequency part of a repeating rule

“I”

the instance designator, represented by the character “I”, indicates that a specific instance is to be selected within the time scale component

“L”

the selection prefix designator, represented by the character “L”, preceding the component which represents the selection part of a repeating rule until encountering the corresponding suffix designator.

“N”

the selection suffix designator, represented by the character “N”, following the component which represents the selection part of a repeating rule from the corresponding prefix designator.

“R”

the recurring time interval designator, represented by the character “R”

x

the representation of any character “x” as according to the textual representation of “x” in the ISO/IEC 646 (all parts) repertoire

NOTE  The choice of “L” and “N” for the selection designators is due to the fact that the word “selection” contains both “L” and “N” in the correct order.

3.2.5.  Separator symbols

In date and time expressions and date and time representations, the following characters are used as separators.

“.” (period) and “,” (comma)

the “.” period and “,” comma characters are decimal signs used to separate the integer part from the decimal fraction of a number.

“/” (solidus)

the “/” solidus character separates start and end times in the representation of a time interval, as well as the symbol ‘R’ from the remainder of a recurring time interval representation. A solidus may be replaced with a double hyphen [“—”] by mutual agreement of the communicating partners.

4.  Set notation

4.1.  General

A set is considered to be an orderless collection of elements.

4.2.  Integer set

Curly braces enclosing a set of integers (with no specified order and separated by commas and zero or more spaces) are used to mean “all members of the set”.

Empty spaces ([” “]) after or before the element divider ([“,”]) within a set expression are considered superfluous and only allowed for better readability. The evaluation of a set expression should always omit such empty spaces.

intset = ["{"][intexpr-1][","][intexpr-2][","] ... [intexpr-n]["}"]

Figure 1

Where,

  • intexpr-i is [i] (a positive integer) or [!]["-"][i] (a negative integer)

EXAMPLE 1

{1, 3, 5} is a set of integers 1, 3 and 5.

EXAMPLE 2

{-3, -6, 9} is a set of integers -3, -6 and 9.

4.3.  Date and time expression set

The notation form specified in Clause 4.2 also applies to a set of date and time expressions.

exprset = ["{"][expr-1][","][expr-2][","] ... [expr-n]["}"]

Figure 2

Where,

  • [expr-i] is a valid date and time expression

EXAMPLE

{1K,3K,5K} is a set that contains the expressions for Monday, Wednesday and Friday.

4.4.  Integer set expansion for date and time expressions

An integer set [intset] can replace a time component value [i] in a representation as long as the resulting expression is valid.

intexpand = [intset][symbol(c)]

Figure 3

Where,

  • [symbol(c)] is the designated symbol for the time scale component.

EXAMPLE 1

If c is the timescale component “month”, [symbol(month)] is the symbol for the calendar month time scale component — the designated symbol ["M"].

EXAMPLE 2

{1,2,3}K is a set that expands to {1K,2K,3K}, which contains the expressions to specify Monday, Wednesday and Friday.

EXAMPLE 3

2018YGP2M{1,3,5}I expresses a shorter form of the set representation of { 2018Y1M1D/2018Y2M28D, 2018Y5M1D/2018Y6M30D, 2018Y9M1D/2018Y10M31D } that uses time intervals from CC 18011:--.

4.5.  Expression set expansion for date and time expressions

An expression set [exprset] can be expanded with another date and time expression as long as the resulting expression is valid.

exprexpand = [exprset][expr]

Figure 4

Where,

  • [expr] is a date time expression, such that when conjoined with individual elements of [exprset] the resulting expanded set of date and time expressions remain valid.

EXAMPLE 1

{2018Y3M,2019Y2M}1D is a set that expands to {2018Y3M1D,2019Y2M1D}, which contains the date expressions for year 2018 March 1st and year 2019 February 1st.

EXAMPLE 2

{1778Y3M,1889Y2M}{10,20}D utilizes the syntax of Clause 4.4 and Clause 4.5, where the set expands to {1778Y3M10D,1889Y2M10D,1778Y3M20D,1889Y2M20D}. Since the order of elements are not specified within a set, the expression is equivalent to {1778Y3M10D,1778Y3M20D,1889Y2M10D,1889Y2M20D}.

5.  Selection of date and time

5.1.  General

A time scale component can be replaced with selection rules to specify matching criteria of certain time scale unit values. This clause builds upon the “explicit” syntax of time scale components specified in CC 18011:--.

[selection] may include zero or more selection rules.

selection = ["L"][selection-rule-1]...[selection-rule-n]["N"]

Figure 5

Where,

  • [“L”] is the selection prefix designator;

  • [“N”] is the selection suffix designator;

  • between the selection prefix and suffix designator, there can be multiple [selection-rule-n] selection rules, which are defined in this clause.

A selection expression describes either:

  • a set of time scale components, which may be continuous or disjoint on a time scale;

  • a single instance of a time scale component, when the instance component (["I"]) is invoked.

EXAMPLE 1

L{1,3,5}KN, “Mondays, Wednesdays and Fridays”, describes a set of disjoint calendar days (all three calendar days are not adjacent to each other).

EXAMPLE 2

L{1,2}MN, “Januarys and Februarys”, describes a set of calendar months that are continuous on one side (January is next to February), but disjoint on the other, when placed on the time scale (March to December are excluded from this expression).

EXAMPLE 3

L1K1IN, “the first Monday”, describes a single calendar day.

NOTE: Selection rules specified in this clause are a superset to those of the “RECUR” syntax specified in RFC 5545; while it is possible to translate certain selection rules specified in this document to that syntax, exceptions and limitations are noted within context of the rules specified below.

5.2.  Selection rules

5.2.1.  Selection of calendar month of year

This selection rule specifies a set of calendar months of the calendar year.

Representation:

monthSR = [monthE]

Figure 6

Valid values are [1] to [12], corresponding to the ordinal number of the calendar month.

EXAMPLE 1

3M represents the third calendar month of the calendar year, i.e. March.

EXAMPLE 2

12M represents the twelfth calendar month of year, i.e. December.

5.2.2.  Selection of calendar week of year

This selection rule specifies a set of ordinals specifying calendar weeks of the calendar year. Since the calendar week of year component has a changeable bound, negative values of week are allowed for specifying the week of year number in reverse.

Representation:

weekSR = [weekE]

Figure 7

Valid values are [1] to [53] and [-53] to [-1]. This corresponds to the number of calendar weeks of a year according to week numbering as defined in ISO 8601-1:--.

EXAMPLE 1

The tenth week of the calendar year is represented by the expression ‘10W’.

EXAMPLE 2

The second last week of the calendar year is represented by the expression ‘-2W’.

NOTE 1  Week 53 can only occur when Thursday is January 1 or if it is a leap calendar year and Wednesday is January 1, in accordance with ISO 8601-1:--, Clause 4.2.2.

NOTE 2  Refer to CC 18011:--, Clause 6.7 for negative values of weeks.

NOTE 3  Definitions of the calendar week and the week number are provided in ISO 8601-1:--.

NOTE 4  RFC 5545 specifies that this rule should only be present when the frequency of the repeat rule is set to yearly (Clause 6.3.2, a)).

5.2.3.  Selection of calendar day of month

This selection rule specifies a set of days of the calendar month. Since the calendar day of month has a changeable bound, negative values of calendar day of month are allowed for specifying the day of month ordinal number in reverse.

Representation:

daySR = [dayE]

Figure 8

Valid values are [1] to [31] and [-31] to [-1]. This corresponds to the maximum number of calendar days of a calendar month.

EXAMPLE 1

18D represents the eighteenth calendar day of the calendar month.

EXAMPLE 2

-10D represents the tenth to the last calendar day of the calendar month.

NOTE  RFC 5545 does not allow this selection rule when the frequency part is set to weekly (Clause 6.3.2, c)).

5.2.4.  Selection of week days

This selection rule specifies a set of days of the week.

Representation:

daykSR = [daykE]

Figure 9

Valid values are [1] to [7].

EXAMPLE 1

Within a monthly context, “1K” represents all Mondays within the calendar month.

EXAMPLE 2

In a yearly context, 5K represents all Fridays in the calendar year.

5.2.5.  Selection of ordinal days in calendar year

This selection rule specifies a set of ordinal days of the calendar year, and should only be specified when the interval of the repeat rule is set to yearly (Clause 6.3.2, a)), monthly (Clause 6.3.2, b)) or daily (Clause 6.3.2, d)).

Since the number of days in a calendar year has a changeable bound, negative values of calendar day of year are allowed for specifying the day of year ordinal number in reverse.

Representation:

dayoSR = [dayoE(m)]

Figure 10

Valid values are [1] to [366] and [–366] to [-1].

NOTE  The values of [366] and [-366] are used to match a calendar leap year

EXAMPLE 1

-1O represents the last day of the calendar year (December 31st).

EXAMPLE 2

-306O represents the 306th to the last day of the calendar year (March 1st of a normal year).

5.2.6.  Selection of hours

This selection rule specifies a set of hours of the calendar day.

Representation:

hourSR = [hourE]

Figure 11

Valid values are [0] to [23].

EXAMPLE 1

‘23H’ represents the 23rd (last) hour of day.

EXAMPLE 2

‘0H’ represents the beginning hour of day.

5.2.7.  Selection of minutes

This selection rule specifies a set of minutes within an hour.

Representation:

minSR = [minE]

Figure 12

Valid values are [0] to [59].

EXAMPLE 1

59M represents the 59th minute of an hour.

EXAMPLE 2

3M represents the third minute of an hour.

5.2.8.  Selection of seconds

This selection rule specifies a set of seconds within a minute.

Representation:

secSR = [secE]

Figure 13

Valid values are [0] to [60].

EXAMPLE 1

30S represents the 30th second of the clock hour.

EXAMPLE 2

60S represents a leap second.

NOTE 1  The value of [60] is used to match a leap second of the calendar year.

NOTE 2  The value of [60] should be changed to [59] when converting such rule that to the RFC 5545 BYSECOND since it does not support a value of [60].

5.2.9.  Selection of position

The position rule, if present, should be applied last, and only when there is at least one selection rule preceding it. It selects a set of occurrence that is a subset of the occurrences already selected (by the selection rules preceding it).

Representation:

positionSR = [position]["`I`"]

Figure 14

Where,

  • [position] is a positive or negative integer, [!]["-"][i].

When used in conjunction with a set of occurrences, [position] identifies the i-th occurrence amongst the set of occurrences.

Specifically, position numbers within a set of occurrences is considered to start with [1] (the first occurrence of the set of occurrences), and [-1] represents the first occurrence when counted backwards.

EXAMPLE 1

“The last work day of calendar months” can be represented by the repeating rule L{1,2,3,4,5}K-1IN (using notation specified in Clause 4)

EXAMPLE 2

“The first Monday of the calendar year” can be represented as the selection rule L{1..7}O1K1IN. {1..7}O represents the first seven days of the calendar year, 1K represents Monday, 1I represents the first instance.

EXAMPLE 3

“The second Monday of the calendar year” can be represented as the selection rule L{1..14}O1K2IN

Valid values for [position] are bound to the time scale components in the context. The integer value [0] is not allowed.

EXAMPLE 4

In a monthly context, the expression L{1,2,3}D100IN is invalid because in a single calendar month, days that can match the calendar day of month numbers 1, 2 and 3 are only 3, therefore the position of 100 cannot be selected.

EXAMPLE 5

In a monthly context, the expression ‘L2K2IN9D’ refers to the ninth day following the second Tuesday.

5.3.  Selection with duration

This selection rule allows extending the previous selection rule with a duration.

Representation:

durSR = [selection-component]["/"][duration]

Figure 15

Where,

  • [selection-component] are selection components defined in this clause;

  • [duration] is a valid duration.

EXAMPLE 1

‘LL1K{1,3}IN/P5DN’ expresses the selection of a set of time intervals starting on the first and third Mondays, each of a duration of 5-days long.

EXAMPLE 2

‘LLL2K2IN/P9DN4K2IN’ expresses the selection of “the second Thursday following the second Tuesday”, through selecting the “9-day blocks starting at the second Tuesday, then select the second Thursday in the 9-day blocks”.

NOTE  [selection-component][“/”][duration] is by itself a valid time interval.

5.4.  Application within representations

5.4.1.  General

Selection rules may be used with any date and time representation in explicit form. This representation is especially useful for describing movable days.

EXAMPLE 1

2018Y3ML1KN1I is a valid date expression that refers to the date year 2018, first Monday of March.

EXAMPLE 2

2018Y9MTLT8H20MN3I is a valid date and time expression that refers to the date year 2018, September, the third instance of 08:20 (which is September 3rd, 08:20).

EXAMPLE 3

{2018,2019,2020,2021,2022}YL2M29DN1I is a valid date expression that selects the February 29 leap day. It matches the first instance of the date February 29th in the years 2018 to 2022.

EXAMPLE 4

‘L5M7K2IN’ represents “the second Sunday of May”. When placed in a yearly context, the date falls on the International Mother’s Day.

EXAMPLE 5

‘L11M4K4INT17HZ-05H’ represents the date “8:00:00 p.m. of the fourth Thursday in November, in UTC-05:00”. When placed in a yearly context, it represents 8:00:00 p.m. falling on the U.S. Thanksgiving Day.

EXAMPLE 6

‘L4M{19,20,21,22,23,24,25,26}D4K1IN’ represents the first Thursday after April 18th. When placed in a yearly context, the date falls on the First Day of Summer (sumardagurinn fyrsti) in Iceland.

5.4.2.  Context set by selection

A selection expression can be used to describe a single date or a set of time intervals. In a date and time representation, time scale components can be placed after a selection to point within selected results.

When a selection expression describes a single date, the subsequent components apply within the date.

EXAMPLE 1

‘2018YL1K1IN’ is an expression for a specific calendar day. An expression with time scale components immediately after, such as ‘2018YL1K1INT10H0M0S’, represents a specific date and time.

When a selection expression describes a set of time intervals, the subsequent components apply to all elements of the set.

EXAMPLE 2

‘2018YL{1,2,5}KN’ is an expression for a time interval set. An expression with time scale components immediately after, such as ‘2018YL{1,2,5}KNT10H0M0S’, describe a time interval set ‘{ 2018Y1M1DT10H0M0S, 2018Y1M2DT10H0M0S, 2018Y1M5DT10H0M0S, 2018Y1M8DT10H0M0S, 2018Y1M9DT10H0M0S, 2018Y1M10DT10H0M0S …​ }’

5.4.3.  Within time intervals

A selection expression can be used to describe a time interval start or end.

EXAMPLE 1

‘2018Y9ML1K1IN/P5D’, with the expression contain selection describing a single date, represents the time interval “first Monday in September to 5 days later”.

EXAMPLE 2

‘2018Y9ML{1,3}K1IN/P5D’, with the expression contain selection describing a time interval set, represents the “first and third Monday in September, to 5 days later”. The expression is identical to the set expression ‘{ 2018Y9ML1K1IN/P5D, 2018Y9ML3K1IN/P5D }’.

6.  Recurring time intervals with repeat rules

6.1.  General

This clause extends ISO 8601-1:--, Clause 5.4 “Recurring Time Interval”, by adding a rule part that defines the repeat pattern. The rule part is appended to the recurring time interval structure.

It describes a generic repeat rule representation that is a superset to, but mostly interchangeable with, the RECUR syntax specified in IETF RFC 5545. This feature makes use of representations defined in Clause 5.

6.2.  Method of specification

A recurring time interval is represented as follows:

  • Optionally, a number of occurrences. If absent, the number of occurrences is unbounded. Each occurrence is called an “event”.

  • A time interval, as specified in CC 18011:--, Clause 6.6.

  • A repeat rule.

6.3.  Repeat rule

6.3.1.  General

A repeat rule identifies a set of matching instants according to specification of a repeating cycle used together with selection rules.

repeat-rule = ["F"][eligible-time-intervals][selection]

Figure 16

Where,

  • the frequency designator [“F”] precedes the identification of a series of repeating time intervals (“repeating intervals”);

  • [selection] is specified in Clause 5.

Within each repeating interval, one sub-interval is distinguished, called an “eligible time interval”.

6.3.2.  Eligible time intervals

Within each eligible time interval is one or more occurrences, as determined by [selection-rules], which are optional. If [selection-rules] is omitted, there is a single occurrence at the end of the eligible time interval.

[eligible-time-intervals] in the repeat rule above is one of the following:

  1. Time interval of one or more years: [yearE]

  2. Time interval of one or more months: [monthE]

  3. Time interval of one or more weeks: [weekE]

  4. Time interval of one or more days: [dayE]

  5. Time interval of one or more hours: [hourE]

  6. Time interval of one or more minutes: [minE]

  7. Time interval of one or seconds: [secE]

    • The duration of each repeating interval is the value of [eligible-time-intervals].

      EXAMPLE 1

      If the value of [eligible-time-intervals] is 8Y, the length of each repeating time interval is 8 years.

    • The duration of each eligible time interval is one-unit of the chosen time scale component in which the duration of [eligible-time-intervals] is expressed.

      EXAMPLE 2

      If the value of [eligible-time-intervals] is 8Y, then the time scale component is year, and each eligible interval is of length 1 year.

    • Each eligible time interval begins x-1 units of the selected time scale component following the beginning of its repeating interval, where x is the coefficient of the unit.

      EXAMPLE 3

      If the value of [eligible-time-intervals] is 8Y, the eligible time interval is the 7th year within the 8-year repeating interval.

These properties together determine an exact set of eligible time intervals.

EXAMPLE 4

In the eligibility part, the expression F2Y places the eligible time intervals as the second year of each 2-year repeating interval.

EXAMPLE 5

In the eligibility part, the expression F8D places the eligible time intervals as the 8th day of each 8-day interval.

6.3.3.  Selection part and selection rules

The selection part provides a list of one or more selection rules, which specify conditions of matching one or more instants within a set of time intervals. Representations for possible selection rules are specified in Clause 5.

When used with a set of eligible time intervals, the selection part identifies a set of instants within the eligible time intervals that match the selection rules. Each instant marks the beginning of an occurrence (a recurring interval).

6.4.  Complete representation

A complete representation of a recurring time interval with repeat rules, shall be in accordance with Clause 5 and Clause 6.3, combining any time interval representation as defined in CC 18011:-- and in ISO 8601-1:--, Clause 5.4.3, with the repeat rule:

["R"][i]["/"][time-interval]["/"][repeat-rule]

Figure 17

Where,

  • [“R”] is the recurring time interval designator;

  • [i] is the number of recurrences (optional);

  • [time-interval] is a valid time interval;

  • [repeat-rule] is a repeat rule defined in Clause 6.3.

The following examples all show a recurring interval of 12 occurrences, each of 90 minutes duration. The first occurrence begins September 29, 2015 at 2pm. The second occurrence begins two weeks later, and so on.

EXAMPLE 1

R12/20150929T140000/20150929T153000/F2W, interval in implied form, specified by start and end

EXAMPLE 2

R12/20150929T140000/P1H30M0S/F2W, interval in implied form, specified by start and duration

EXAMPLE 3

R12/P2H30M0S/20150929T153000/F2W, interval in implied form, specified by duration and end

EXAMPLE 4

R12/2015‑09‑29T14:00:00/2015‑09‑29T15:30:00/F2W, interval in extended form, specified by start and end

EXAMPLE 5

R12/2015‑09‑29T14:00:00/P1H30M0S/F2W, interval in extended form, specified by start and duration

EXAMPLE 6

R12/P1H30M0S/2015‑09‑29T15:30:00/F2W, interval in extended form, specified by duration and end

EXAMPLE 7

R12/2015Y9M29DT14H0M0S/2015Y9M29DT15H30M00S/F2W, interval in explicit form, specified by start and end

EXAMPLE 8

R12/2015Y9M29DT14H0M0S/P1H30M0S/F2W, interval in explicit form, specified by start and duration

EXAMPLE 9

R12/P1H30M0S/2015Y9M29DT15H30M00S/F2W, interval in explicit form, specified by start and duration

6.5.  Representations other than complete

A representation other than complete of a recurring time interval with repeat rule shall be an expression in accordance with Clause 5 and Clause 6.3, where the time interval is represented in accordance with ISO 8601-1:--, Clause 4.4.5.

6.6.  Evaluation of a repeat rule

6.6.1.  General

A repeat rule specifies a set of occurrences where each occurrence is a time interval.

The occurrences resulting from a repeat rule are calculated as follows:

  • determine the eligible time intervals;

  • apply all selection rules to the eligible time intervals; and

  • obtain the resulting occurrences.

A detailed explanation of interactions between eligible time intervals and the selection part is provided in Appendix A.

Evaluation compatibility with RFC 5545 is discussed in Appendix B.

EXAMPLE 1

The expression ‘R/2018-08-08/P1D/F1YL{3,8}M8DN’, means “for every year, select the calendar months 3 (March) and 8 (August), calendar day 8, for an occurrence of 1 day duration”. The resulting occurrences are therefore { ‘2018-08-08/2018-08-09’, ‘2019-03-08/2019-03-09’, ‘2019-08-08/2019-08-09’, … }.

EXAMPLE 2

The expression ‘R/2018-08-01T10:20:00/PT10M/F1ML{1,10}DT10H20M0SN’, means that “for every month, select the calendar days 1 and 10, time 10:20:00, for an occurrence of 10 minutes duration”. The resulting occurrences are therefore { ‘2018-08-01T10:20:00/2018-08-01T10:30:00’, ‘2018-09-01T10:20:00/2018-09-01T10:30:00’,, … }.

EXAMPLE 3

The expression ‘R/2018-09-01/P1D/F1YL9M3K1IN’, means “for every year, select the first Wednesday in September for an occurrence of 1 day duration”. The resulting occurrences are therefore { ‘2018-09-05/2018-08-06’, ‘2019-09-04/2019-09-05’, ‘2020-09-02/2020-09-02’, … }.

6.6.2.  Time scale unit precision

The resulting occurrences of a repeat rule shall have a time scale unit resolution equal to the lowest order time scale unit specified in the repeat rule.

EXAMPLE 1

In the expression R/2018Y1M/P1M/F3M, the lowest order time scale unit specified is month, hence the resolution is month precision. This expression resolves to the set { 2018-01/2018-02, 2018-04/2018-05 …​ }

EXAMPLE 2

In the expression R/2018Y1M1D/P1D/F3M, the lowest order time scale unit specified is day, hence the resolution is day precision. This expression resolves to the set { 2018-01-01/2018-01-02, 2018-04-01/2018-04-02 …​ }

EXAMPLE 3

In the expression R/2018Y1M/PT10M/F1M, the lowest order time scale unit specified is minute, hence the resolution is minute precision. This expression resolves to the set { 2018-01-01T00:00/2018-01-01T00:10, 2018-02-01T00:00/2018-02-01T00:10, …​ }

6.6.3.  Inheritance of component values from time interval start

In a repeat rule with a selection part, the selection rules specified do not always fully account for all the time scale components provided in the initial start time, i.e. when there is no selection part, or if there is no one-to-one correspondence of time scale units used in the initial start time and those used in the selection part.

In this case, the selection rules shall inherit from time interval start the values of time scale units that are of lower order than those used in the eligibility part.

EXAMPLE 1

Given the expression ‘R/2018-08-01T01:02:03/P5M/F1D’, there is no selection part, however, the selection part is inferred from the time scale units of lower order than that of the eligibility part ‘F1D’, the “calendar day” unit. The specific time scale units specified in the time interval start and of lower order than “calendar day” are clock hour, clock minute and clock second. The inferred selection part directly takes values for those units from time interval start, resulting in the selection part ‘LT1H2M3S’. The resulting occurrences are therefore { ‘2018-08-01T01:02:03/2018-08-01T01:07:03’, ‘2018-08-02T01:02:03/2018-08-02T01:07:03’, … }.

EXAMPLE 2

Given the expression ‘R/2018Y8M1DT1H/P1D/F2ML{1,3}D’, the eligible time intervals are the second month of a 2-month period, selecting for the calendar days “1” and “3”. Since the time scale units of lower order than calendar day (“D”) do not have specified units, the clock hours from the initial start date is inherited in the selection rule, resulting in the selection part ‘L{1,3}DT1H’. The resulting occurrences are { ‘2018Y8M1DT1H/2018Y8M2DT1H’ , ‘2018Y8M3DT1H/2018Y8M3DT1H’, ‘2018Y10M1DT1H/2018Y10M2DT1H’ , ‘2018Y10M3DT1H/2018Y10M3DT1H’, … }

EXAMPLE 3

‘R/20150104T083000/PT15M00S/F2YL1M1KT{8,9}H30M’ expresses a recurring interval (number of occurrences is unspecified) whose first occurrence is January 4, 2015, 8:30-8:45 AM, and subsequent occurrences, all of the same duration (15 minutes), are determined by the repeat cycle for which the following evaluation sequence is provided:

  • the expression ‘2Y’ indicates that the eligible time intervals have a repeating cycle of two years, and each eligible time interval is 1 year in length, the second year within its repeating interval;

  • From this information together with the specification of the first occurrence, it is calculated that:

    • the first eligible time interval is the calendar year 2015 (the year during which the first occurrence takes place)

    • the first repeating interval is the two-year period comprising calendar years 2014 and 2015;

  • the subsequent recurring intervals are then determined by the selection part;

    • the expression ‘1M’ indicates that the matching occurrences are limited to January only;

    • the expression ‘1K’ indicates that the matching occurrences are limited to Sundays only;

    • the expression ‘{8,9}H’ indicates that the matching occurrences have clock hours 8 or 9;

    • the expression ‘30M’ indicates that the matching occurrences have a clock minute value of 30, combined with specified clock hours, the starting times are determined to be 8:30AM and 9:30 AM;

    • since the selection rules lacks specified values for clock seconds, in accordance with 14.6.3, they should be obtained from the clock seconds value of the “time interval start” of ‘20150104T083000’, hence the clock seconds selection rule is specified as value ‘00’;

    • the recurrent occurrences therefore resolve to the rule “in the second year of every two year period beginning year 2014, for every Sunday in January at both 8:30:00 AM and 9:30:00 AM, create a 15 minutes occurrence.”


Appendix A
(informative)
Interactions between eligible time intervals with the selection part

A.1.  General

The interaction between eligible time intervals and selection rules specified within a repeating rule give rise to interesting properties that users should be aware of.

A.2.  Sample evaluation of a recurring time interval with repeat rules

R/20150104T083000/PT15M00S/F2YL1M1KT{8,9}H30MN expresses a recurring interval (number of occurrences is unspecified) whose first occurrence is January 4, 2015, 8:30-8:45 AM, and subsequent occurrences, all of the same duration (15 minutes), are determined by the repeat cycle for which the following evaluation sequence is provided.

  • the character F indicates that the formula for determining eligible time intervals follows;

  • the expression 2Y indicates that the eligible time intervals have a repeating cycle of two years, and each eligible time interval is 1 year in length, the second year within its repeating interval;

  • From this information together with the specification of the first occurrence, it is calculated that:

    • the first eligible time interval is the calendar year 2015 (the year during which the first occurrence takes place)

    • the first repeating interval is the two-year period comprising calendar years 2014 and 2015;

  • the subsequent recurring intervals are then determined by the selection part;

    • the character L indicates that selection parts follow;

    • the expression 1M indicates that the matching occurrences are limited to January only;

    • the expression 1K indicates that the matching occurrences are limited to Sundays only;

    • the expression T indicates that intraday time scale components follow;

    • the expression {8,9}H indicates that the matching occurrences have clock hours 8 or 9;

    • the expression 30M indicates that the matching occurrences have a clock minute value of 30, combined with specified clock hours, the starting times are determined to be 8:30AM and 9:30 AM;

    • since the selection rules lacks specified values for clock seconds, in accordance with 9.3.3, they should be obtained from the clock seconds value of the “time interval start” of 20150104T083000, hence the clock seconds selection rule is specified as value 00;

    • the recurrent occurrences therefore resolve to the rule “in the second year of every two year period beginning year 2014, for every Sunday in January at both 8:30:00 AM and 9:30:00 AM, create a 15 minutes occurence.”

Figure A.1 — Resulting occurrences of the rule F3YL{2,4,6,8,10}M1DN

Figure A.1 demonstrates that the repeating cycle denotes how often the eligible time intervals be evaluated. Within the eligible time intervals, the selection rules are applied. It is the overlap between the selection rules and eligible time intervals that produce the resulting occurrences.

A.3.  Special case when the repeating cycle uses value 1

When the repeating cycle is defined with a value 1 for any time unit (e.g. calendar year, calendar month, calendar day, calendar hour, etc.), the effect on the resulting occurrences are identical – the repeating cycle fully covers all instants of the time scale. Therefore, the resulting occurrences are fully described by the selection rules that apply.

A.4.  Orders of the repeating cycle and selection rules

A.4.1.  Repeating cycle of higher order than selection rules

It is common in natural expressions and in calendar implementations that the repeating cycle uses a time scale unit of a higher order than that of the selection rules. The resulting occurrences are generally as expected by the creator of these rules.

EXAMPLE

Figure A.2 provides such a case; where the resulting occurrences happen once every three years, matching a single date of September 10th.

Figure A.2 — When the repeating cycle is of a higher order than the selection part

A.4.2.  Repeating cycle of same order with selection rules

When a time scale unit of the same order is used for both the repeating cycle and the selection rules, the following properties arise:

EXAMPLE 1

A repeating rule of 1 month repeating cycle, with selection rules that are of the highest order of “month”, has the same effect as the repeating cycle of 1 calendar year because every calendar month in the calendar year will be evaluated

  • A repeating rule with an n time unit repeating cycle, matched with selection rules of the same time unit, will provide occurrences that depend on the start instant of the repeating cycle.

EXAMPLE 2

A repeating cycle starting in April every 6 months will only match a monthly selection rule that contains April or October

EXAMPLE 3

Figure A.3 demonstrates an instance of the second case where the repeating cycle does not overlap with eligible time intervals, resulting in no occurrences.

Figure A.3 — When the repeating cycle is of the same order as the selection part and mismatches

A.4.3.  Repeating cycle of lower order than selection rules

When a time scale unit of a lower order is used for the repeating cycle than that of the selection rules, the following should be of note:

  • The effect of Appendix A.3 applies;

  • A repeating rule with an n time unit repeating cycle, matched with selection rules of a lower order time unit, will provide occurrences that depend on the start instant of the repeating cycle.

EXAMPLE

Figure A.4 demonstrates this interaction of the second case, where the repeating cycle is of day order and a selection rule of calendar month order. Notice that there are no matches outside calendar month 3 due to the application of the selection rule.

Figure A.4 — When the repeating cycle is of a lower order than the selection part


Appendix B
(informative)
Compatibility considerations of repeat rules with RFC 5545 recurrences

B.1.  Evaluation of repeat rules

In this document, the evaluation of repeat rules (see Clause 6.3) rely on explicit specification of selection rules (see Clause 5) and the direct inheritance of time scale component information from the initial start date.

B.2.  Inheritance of time scale component information

In the evaluation of repeat rules within this document as well as in RFC 5545, a number of time scale components can be directly inherited from the initial start date.

In terms of RFC 5545 specifically:

  • when the FREQ parameter is set to SECONDLY, but without a BYSECOND parameter, the BYSECOND selection is directly inherited from the clock seconds value from the initial start date;

  • when the FREQ parameter is set to MINUTELY, but without a BYMINUTE parameter, the BYMINUTE selection is directly inherited from the clock minutes value from the initial start date;

  • when the FREQ parameter is set to HOURLY, but without a BYHOUR parameter, the BYHOUR selection is directly inherited from the clock hours value from the initial start date.

B.3.  Implicit selection rules of RFC 5545

In RFC 5545, however, the evaluation of certain repeat rules also relies on implicit selection rules inherited indirectly from the initial start date.

Specifically,

  • when the FREQ parameter is set to WEEKLY, but without a BYDAY parameter, the BYDAY selection is inherited from the calendar day of week value from the initial start date (note that the calendar day of week value is not directly specified in the initial start date, but it has to be inferred);

  • when the FREQ parameter is set to MONTHLY, but without both `BYMONTHDAY and BYDAY parameters, the BYMONTHDAY selection is inherited from the calendar month of year value from the initial start date;

  • when the FREQ parameter is set to YEARLY but without a BYYEARDAY parameter,

    • if no BYMONTH or BYWEEKNO parameter is set:

      • if the BYMONTHDAY parameter is provided, then the BYMONTH selection is inherited from the calendar month of year value from the initial start date;

      • if the BYDAY parameter is not set, then the BYMONTH selection is inherited from the calendar month of year value from the initial start date;

    • if no BYMONTHDAY, BYWEEKNO or BYDAY parameter is set, the BYMONTHDAY selection is inherited from calendar day of month of the initial start date;

    • if there is a BYWEEKNO parameter set but no BYMONTHDAY or BYDAY, the BYDAY selection is inherited from the calendar day of week of the initial start date.

EXAMPLE

In evaluating a simplified example expression from RFC 5545, with DTSTART set to 19970902T090000 and RRULE set to FREQ=WEEKLY;INTERVAL=2, will result in the instance series of “1997 September 2, 16, 30; October 14…​”. This resulting instance series relies on an implicit understanding that FREQ=WEEKLY always requires selection of the BYDAY parameter, which is not specified in the original selection rule. In this case, BYDAY is implicitly set to Tuesdays as originally obtained from the DTSTART value being a Tuesday.

B.4.  Achieving equivalent selection criteria in RFC 5545 syntax

Using mechanisms described in this document, implicit selection rules are not allowed. In order to convert a RFC 5545 recurrence rule into a repeat rule specified by Clause 6.3, the implicit selection rules based on indirect inheritance must be made into explicit selection rules.

EXAMPLE

Following the example in Appendix B.3, the value of Tuesday is considered to be indirectly inferred from the initial start date since it is not explicitly specified. To achieve the same effect using mechanisms of this document, the BYDAY selection rule in RFC 5545 must be explicitly set as a selection rule, such as in L1KN.


Bibliography

[1]  ISO/IEC 646 (all parts), Information technology – ISO 7-bit coded character set for information interchange

[2]  ISO 8601:2004, Data elements and interchange formats – Information interchange – Representation of dates and times

[3]  IETF RFC 5545, Internet Calendaring and Scheduling Core Object Specification (iCalendar)