Icalendar syntax

From wikinotes

Documentation

RFC-5545 https://tools.ietf.org/html/rfc5545


Basic Structure

ics files are composed of blocks consisting of nested

  • calendars
  • events
  • alarms

A single file can contain multiple calendars,
Calendars can contain multiple events,
events can contain multiple alarms etc.

BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
CREATED:20160229T160511Z
LAST-MODIFIED:20160229T161249Z
DTSTAMP:20160229T161249Z
UID:eaba636d-13b6-4ab1-835a-af1cb8744df5
SUMMARY:Vacation
DTSTART;TZID=America/Toronto:20200713T090000
DTEND;TZID=America/Toronto:20200708T180000
END:VEVENT
END:VCALENDAR

Alarms

Indentation added for readability

BEGIN:VCALENDAR
  PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN
  VERSION:2.0

  BEGIN:VEVENT
    CREATED:20160305T171040Z
    LAST-MODIFIED:20160305T171105Z
    DTSTAMP:20160305T171105Z
    UID:00ccc052-ac26-4aa3-9105-f02b2e12e497
    SUMMARY:Some Birthday
    RRULE:FREQ=YEARLY
    DTSTART;VALUE=DATE:20160613
    DTEND;VALUE=DATE:20160614
    TRANSP:TRANSPARENT

    BEGIN:VALARM
      ACTION:DISPLAY
      TRIGGER;VALUE=DURATION:PT0S
      DESCRIPTION:Default Mozilla Description
    END:VALARM

    BEGIN:VALARM
      ACTION:DISPLAY
      TRIGGER;VALUE=DURATION:-P1W
      DESCRIPTION:Default Mozilla Description
    END:VALARM

  END:VEVENT
END:VCALENDAR

Recurring Events

Recurring events are controlled by the RRULE parameter.
It is configured on a single line, the following is a rough
summary of how it works.

BEGIN:VEVENT
  CREATED:20160305T171040Z
  DTSTAMP:20160305T171105Z
  SUMMARY:Some Birthday
  RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU;UNTIL=20061029T060000Z
END: VEVENT
'FREQ'       : vFrequency,        # Mandatory (weekly, yearly, daily, ...)
'UNTIL'      : vDDDTypes,
'COUNT'      : vInt,              # Number of times to recur. (if not present, always recur)
'INTERVAL'   : vInt,              # Every nth 'FREQ' value

# In addition to frequency, you can specify when
# a reminder occurs. A FREQ='yearly' reminder with
# a BYWEEKNO='-1' would issue a reminder on the last
# day of every year.
'BYSECOND'   : '0,1,2'            # (0-60) comma-separated list of seconds
'BYMINUTE'   : '0,1,2'            # (0-59) comma-separated list of minutes
'BYHOUR'     : '0,1,2'            # (0-23) comma-separated list of hours
'BYWEEKNO'   : '0,1,2'            # (1-53) comma-separated list of weeks of the year
'BYMONTHDAY' : '0,1',  '-1,-2'    # (1-31)((-1)-(-31))   comma-separated list of days of month
'BYYEARDAY'  : '1,2',  '-1,-2'    # (1-366)((-1)-(-366)) comma-separated list of days of year
'BYMONTH'    : '
'BYDAY'      : vWeekday,

# 'BYSETPOS' modifies a 'BY*' parameter.
# In the example below, a reminder is issued on the
# last workday(mon-fri) every month.
# FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1
'BYSETPOS'   : vInt,

# Starting the week on a different day
# can have an effect on events with modified
# intervals.
'WKST'       : 'SU','MO', ..