The Internet Calendaring and Scheduling Core Object Specification (iCalendar) is a media type which allows users to store and exchange calendaring and scheduling information such as events, to-dos, journal entries, and free/busy information, and together with its associated standards has been a cornerstone of the standardization and interoperability of digital calendars across different vendors. Files formatted according to the specification usually have an extension of `.ics`. With supporting software, such as an email reader or calendar application, recipients of an iCalendar data file can respond to the sender easily or counter-propose another meeting date/time. The file format is specified in a proposed Internet standard (RFC 5545) for calendar data exchange. The standard and file type are sometimes referred to as "iCal", which was the name of the Apple Inc. calendar program until 2012 (see iCal), which provides one of the implementations of the standard.
## Format
iCalendar data have the [MIME](MIME.md) content type `text/calendar`. The filename extension of `ics` is to be used for files containing calendaring and scheduling information, `ifb` for files with free or busy time information consistent with this [MIME](MIME.md) content type. There are also variations of this format in [JSON](JSON.md) (jCal) or [XML](XML.md) (xCal).
By default, iCalendar uses the [UTF-8](Unicode.md) character set; a different character set can be specified using the "charset" [MIME](MIME.md) parameter (if the transport method used supports MIME, such as [Email](../internet/eMail.md) or [HTTP](../internet/HTTP.md)). Each line is terminated by `CR+LF` (in hexadecimal: `0D0A`). Lines should be limited to 75 octets (not characters) long. Where a data item is too long to fit on a single line it can be continued on following lines by starting the continuation lines with a space character (in hex: `20`) or a tab character (in hex: `09`). Actual line feeds in data items are encoded as a backslash followed by the letter n or N (the bytes `5C 6E` or `5C 4E` in [UTF-8](Unicode.md)).
The iCalendar format is designed to transmit calendar-based data, such as events, and intentionally does not describe what to do with that data. Thus, other programming may be needed to negotiate what to do with this data. A companion standard, "iCalendar Transport-Independent Interoperability" (iTIP) (RFC 2446), defines a protocol for exchanging iCalendar objects for collaborative calendaring and scheduling between "Calendar Users" (CUs) facilitated by an "Organizer" initiating the exchange of data. This standard defines methods such as `PUBLISH`, `REQUEST`, `REPLY`, `ADD`, `CANCEL`, `REFRESH`, `COUNTER` (to negotiate a change in the entry), and `DECLINE-COUNTER` (to decline the counter-proposal). Another companion standard, "iCalendar Message-based Interoperability Protocol (iMIP)" (RFC 2447), defines a standard method for implementing iTIP on standard Internet [email](../internet/eMail.md)-based transports. The "Guide to Internet Calendaring" (RFC 3283) explains how iCalendar interacts with other calendar computer language (current and future).
The top-level element in iCalendar is the Calendaring and Scheduling Core Object, a collection of calendar and scheduling information. Typically, this information will consist of a single iCalendar object. However, multiple iCalendar objects can be grouped together. The first line must be `BEGIN:VCALENDAR`, and the last line must be `END:VCALENDAR`; the contents between these lines is called the "icalbody". The body must include the `PRODID` and `VERSION` calendar properties. In addition, it must include at least one calendar component.
`VERSION:1.0` is used to specify that data is in the old vCalendar format. `VERSION` is 2.0 for the current iCalendar format as of 2016.
The body of the iCalendar object (the icalbody) contains single-line Calendar Properties that apply to the entire calendar, as well as one or more blocks of multiple lines that each define a Calendar Component such as an event, journal entry, alarm, or one of several other types. Here is a simple example of an iCalendar object with a single calendar containing a single Calendar Component, a "Bastille Day Party" event starting at 5pm on July 14, 1997, and ending at 4am the following morning:
The UID field distributes updates when a scheduled event changes. When the event is first generated a globally unique identifier is created. If a later event is distributed with the same UID, it replaces the original one. An example UID might be `Y2007S2C131M5@example.edu`, for the 5th meeting of class 131 in semester 2 at a hypothetical college. Email-style UIDs are now considered bad practice, with a [UUID](../linux/UUID.md) recommended instead.
The most common representation of date and time is a tz timestamp such as `20010911T124640Z` with the format `<year (4 digits)><month (2)><day (2)>T<hour (2)><minute (2)><second (2)>Z` for a total fixed length of 16 characters. Z indicates the use of UTC (referring to its Zulu time zone). When used in `DTSTART` and `DTEND` properties, start times are inclusive while end times are not. This allows an event's end time to be the same as a consecutive event's start without those events overlapping and potentially creating (false) scheduling conflicts.
Components include:
-`VEVENT` describes an event, which has a scheduled amount of time on a calendar. Normally, when a user accepts the calendar event, this will cause that time to be considered busy, though an event can be set to be `TRANSPARENT` to change this interpretation. A `VEVENT` may include a `VALARM` which allows an alarm. Such events have a `DTSTART` which sets a starting time, and a `DTEND` which sets an ending time. If the calendar event is recurring, `DTSTART` sets up the start of the first event.
-`VTODO` explains a to-do item, i.e., an action-item or assignment. Not all calendar applications recognize `VTODO` items. In particular, Outlook does not export Tasks as `VTODO` items, and ignores `VTODO` items in imported calendars.
-`VJOURNAL` is a journal entry. They attach descriptive text to a particular calendar date, may be used to record a daily record of activities or accomplishments, or describe progress with a related to-do entry. A `VJOURNAL` calendar component does not take up time on a calendar, so it has no effect on free or busy time (just like `TRANSPARENT` entries). In practice, few programs support `VJOURNAL` entries.
-`VFREEBUSY` is a request for free/busy time, is a response to a request, or is a published set of busy time. Other component types include `VAVAILABILITY`, `VTIMEZONE` (time zones) and `VALARM` (alarms). Some components can include other components (`VALARM` is often included in other components). Some components are often defined to support other components defined after them (`VTIMEZONE` is often used this way).
iCalendar is meant to "provide the definition of a common format for openly exchanging calendaring and scheduling information across the Internet". While the features most often used by users are widely supported by iCalendar, some more advanced capabilities have problems. For example, most vendors do not support Journals (`VJOURNAL`). `VTODOs` have had conversion problems as well.
iCalendar's calendar is also not compatible with some non-Gregorian calendars such as the lunar calendars used in Israel and Saudi Arabia. Although there exist one-to-one mappings between Gregorian and many other calendar scales, the lack of defined `CALSCALE` values for those calendars and limitations in various date fields can make native support impossible. For example the Hebrew calendar year may contain either 12 or 13 months, and the Japanese Emperor-based calendar scale contains many eras.