Difference between revisions of "User:TobyInk/hcalendar-1.1"

From Microformats Wiki
Jump to navigation Jump to search
m (→‎Example: Pluralise)
Line 188: Line 188:
=== Recurrance ===
=== Recurrance ===
Recurrance rules and exclusion rules are complex. hCalendar parsers are not required to support them, and *may* choose to ignore the entire contents of "rrule" and "exrule" properties. But if "rrule" and "exrule" are supported, then they *must* be parsed according to the guidelines in this section of the specification.
That is, parsers should aim to implement "rrule" and "exrule" entirely, or not at all.
The following example iCalendar recurrance rule is given in RFC 2445:
The following example iCalendar recurrance rule is given in RFC 2445:

Revision as of 13:39, 26 February 2008

(I am aware of the existence of hCalendar Brainstorming and task. This is intended to be more of a formal-style document, representing a draft replacement for the current hCalendar 1.0 spec, mostly aimed at filling in areas where the current spec is incomplete or ambiguous, rather than additing newly requested functionality.)

Rather than replacing the current spec, we can iterate on it. If there are areas that you feel are incomplete or ambiguous please post them to a wiki page and as a community we can sort them out and edit the spec together. Some of these idea might have been discussed and dropped previously for various reasons which might not be documented or are buried somewhere. Getting everyone's thoughts onto a page were we can discuss this and find the reference will save everyone time and make for a better result in the end. Brian

hCalendar 1.1


This is a DRAFT version of an update to the hCalendar 1.0 spec.

hCalendar is a simple, open, distributed calendaring and events format, based on the iCalendar standard (RFC2445), suitable for embedding in HTML or XHTML, Atom, RSS, and arbitrary XML. hCalendar is one of several open microformat standards.

Want to get started with writing an hCalendar event? Use the hCalendar creator to write up an event and publish it, or follow the hCalendar authoring tips to add hCalendar markup to your page of upcoming events or events you mention in blog posts, wikis, etc.


Toby Inkster
Tantek Çelik (Technorati, Inc)
Brian Suda
Toby Inkster


Per the public domain release on the authors' user pages (Tantek Çelik, Brian Suda) this specification is released into the public domain.

Public Domain Contribution Requirement. Since the author(s) released this work into the public domain, in order to maintain this work's public domain status, all contributors to this page agree to release their contributions to this page to the public domain as well. Contributors may indicate their agreement by adding the public domain release template to their user page per the Voluntary Public Domain Declarations instructions. Unreleased contributions may be reverted/removed.


This specification is subject to a royalty free patent policy, e.g. per the W3C Patent Policy, and IETF RFC3667 & RFC3668.

Inspiration and Acknowledgments

Thanks to:


The iCalendar standard (RFC2445), has been broadly interoperably implemented (e.g. Apple's "iCal" application built into MacOSX).

In addition, bloggers often discuss events on their blogs -- upcoming events, writeups of past events, etc. With just a tad bit of structure, bloggers can discuss events in their blog(s) in such a way that spiders and other aggregators can retrieve such events, automatically convert them to iCalendar, and use them in any iCalendar application or service.

This specification introduces the hCalendar format, which is a representation of a subset of the aforementioned iCalendar standard, in semantic HTML. Bloggers can both embed hCalendar events and todo items directly in their web pages, and style them with CSS to make them appear as desired. In addition, hCalendar enables applications to retrieve information about such events directly from web pages without having to reference a separate file.

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Semantic XHTML Design Principles

Note: the Semantic XHTML Design Principles were written primarily within the context of developing hCard and hCalendar, thus it may be easier to understand these principles in the context of the hCard design methodology (i.e. read that first). Tantek

XHTML is built on XML, and thus XHTML based formats can be used not only for convenient display presentation, but also for general purpose data exchange. In many ways, XHTML based formats exemplify the best of both HTML and XML worlds. However, when building XHTML based formats, it helps to have a guiding set of principles.

  1. Reuse the schema (names, objects, properties, values, types, hierarchies, constraints) as much as possible from pre-existing, established, well-supported standards by reference. Avoid restating constraints expressed in the source standard. Informative mentions are ok.
    1. For types with multiple components, use nested elements with class names equivalent to the names of the components.
    2. Plural components are made singular, and thus multiple nested elements are used to represent multiple text values that are comma-delimited.
  2. Use the most accurately precise semantic XHTML building block for each object etc.
  3. Otherwise use a generic structural element (e.g. <span> or <div>), or the appropriate contextual element (e.g. an <li> inside a <ul> or <ol>).
  4. Use class names based on names from the original schema, unless the semantic XHTML building block precisely represents that part of the original schema. If names in the source schema are case-insensitive, then use an all lowercase equivalent. Components names implicit in prose (rather than explicit in the defined schema) should also use lowercase equivalents for ease of use. Spaces in component names become dash '-' characters.
  5. Finally, if the format of the data according to the original schema is too long and/or not human-friendly, use <abbr> instead of a generic structural element, and place the literal data into the 'title' attribute (where abbr expansions go), and the more brief and human readable equivalent into the element itself. Further informative explanation of this use of <abbr>: Human vs. ISO8601 dates problem solved

For practical implementations, it should be noted that Internet Explorer's support for styling <abbr> elements is poor, and may require wrapper elements.


In General

The iCalendar standard (RFC2445) forms the basis of hCalendar.

The basic format of hCalendar is to use iCalendar object/property names in lower-case for class names, and to map the nesting of iCalendar objects directly into nested XHTML elements.

The VJOURNAL and VTIMEZONE components of iCalendar are explictly not supported as part of hCalendar. hCalendar authors should not use classes "vjournal" or "vtimezone" within an hCalendar context; parsers must not attempt to interpret them if conforming to this version of the specification. hAtom 0.1 may be used as an altrnative to VJOURNAL for those authors wishing to publish journal information. VTIMEZONE has no suggested direct replacement: authors should restrict themselves to publishing dates in W3CDTF format using only well-known timezones.

Root Class Name

The root class name for hCalendar is "vcalendar". An element with a class name of "vcalendar" is itself called an hCalendar.

The root class name for events is "vevent". An element with a class name of "vevent" is itself called an hCalendar event. The root class name for todo items is "vtodo". An element with a class name of "vtodo" is itself called an hCalendar todo. The root class name for todo items is "valarm". An element with a class name of "valarm" is itself called an hCalendar alarm. The root class name for todo items is "vfreebusy". An element with a class name of "vfreebusy" is itself called an hCalendar freebusy.

For authoring convenience, both all of the above are treated as root class names for parsing purposes. If a document contains elements with class names "vevent", "vtodo", "valarm" or "vfreebusy", but not "vcalendar", the entire document has an implied "vcalendar" context.

Properties and Sub-properties

The properties of an hCalendar are represented by elements inside the hCalendar. Elements with class names of the listed properties represent the values of those properties. Some properties have sub-properties, and those are represented by elements inside the elements for properties.

Property List for hCalendars

  • vevent (hCalendar event)*
  • vtodo (hCalendar todo)*
  • valarm (hCalendar alarm)*
  • vfreebusy (hCalendar freebusy)*

Although each component of an hCalendar is optional and may occur more than once, an hCalendar *should* contain at least one item.


Based on Perl's standard quantifiers:

bold {1} MUST be present exactly once
italic* OPTIONAL, and MAY occur more than once
+ MUST be present, and MAY occur more than once
? OPTIONAL, but MUST NOT occur more than once
[square brackets] list of common values
(parentheses) data format
# comment
! awaiting documentation

Property List for hCalendar Events

hCalendar event properties

  • vevent {1}
    • summary {1}
    • dtstart (ISO date) +
    • description ?
    • comment ?
    • dtend (ISO date) ?
    • duration (ISO date duration) ?
    • url *
    • location (text | Geo | adr | hCard 1.0) *
    • Geo *
    • resources ?
    • attendee (text | hCard 1.0) *
    • organizer (text | hCard 1.0) *
    • contact (text | hCard 1.0) *
    • valarm (hCalendar alarm) *
    • related-to (link) *
    • recurrance-id ?
    • rdate (ISO date) *
    • rrule *
      • freq {1}
      • until|count ? ("until" and "count" are mutually exclusive. "count" is an integer; "until" is an ISO date)
      • interval ?
      • bysecond *
      • byminute *
      • byhour *
      • byday *
      • bymonthday *
      • byyearday *
      • byweekno *
      • bymonth *
      • bysetpos *
      • wkst *
    • exdate (ISO date) *
    • exrule *
      • (as per "rrule")
    • uid ?
    • transp ?
    • class ?
    • priority ?
    • status ?
    • created
    • last-modified
    • sequence

Additionally an hCalendar event may contain zero or more links marked up as rel="tag" corresponding to the CATEGORY property from iCalendar; and zero or more links marked up as rel="enclosure" corresponding to the ATTACH property.

Property List for hCalendar Todos

hCalendar todo items have the same properties as hCalendar events, except they should not contain "transp" or "dtend" properties. The following additional properties are defined:

  • vtodo {1}
    • due (ISO date) ?
    • percent-complete ?
    • completed (ISO date) ?

As per hCalendar events, rel="tag" and rel="enclosure" links may be used.

Property List for hCalendar Alarms

  • valarm {1}
    • summary {1}
    • trigger {1}
    • description ?
    • duration (ISO date duration) ?
    • attendee (text | hCard 1.0) *
    • action ?
    • repeat ?

rel="enclosure" links may be used, but rel="tag" should not.

Property List for hCalendar Freebusys

  • vfreebusy {1}
    • summary {1}
    • freebusy +
    • comment ?
    • dtstart ?
    • dtend ?
    • duration ?
    • attendee (text | hCard 1.0) *
    • organizer (text | hCard 1.0) *
    • contact (text | hCard 1.0) *
    • url (link) *
    • uid ?
    • dtstamp ?

rel="tag" and rel="enclosure" links should not by included.


Recurrance rules and exclusion rules are complex. hCalendar parsers are not required to support them, and *may* choose to ignore the entire contents of "rrule" and "exrule" properties. But if "rrule" and "exrule" are supported, then they *must* be parsed according to the guidelines in this section of the specification.

That is, parsers should aim to implement "rrule" and "exrule" entirely, or not at all.

The following example iCalendar recurrance rule is given in RFC 2445:


This represents an event which occurs every Sunday in January at 08:30 and 09:30, starting on the 5th of January 1997 and only occuring on odd-numbered years. Here is an example of how that might be translated into HTML:

<p>Our organisation has been offering a series of summer lectures since
<abbr class="dtstart" title="19970105T083000">January 1997</abbr>. They
  <span class="rrule">
    held <span class="freq">yearly</span>,
    every <span class="interval">2</span>nd year (1999, 2001, etc),
    every <span class="byday">Sunday</span>
    in January <abbr class="bymonth" title="1" style="display:none"></abbr>
    at <span class="byhour">8</span>:<span class="byminute">30</span> and
    repeated at <span class="byhour">9</span>:30.

This might be rendered as:

Our organisation has been offering a series of summer lectures since January 1997. They are held yearly, every 2nd year (1999, 2001, etc), every Sunday in January at 8:30 and repeated at 9:30.


  1. For further information and allowed values, see section 4.3.10 of RFC 2445.
  2. Although iCalendar doesn't allow the "BY*" properties to be repeated (BYHOUR=8;BYHOUR=9) it does allow a single "BY*" property to contain a comma-separated list of numbers (BYHOUR=8,9). When an hCalendar recurrance rule specifies a repeated "BY*" property, parsers *must* interpret this as being equivalent to a comma-separated list in iCalendar.
  3. RFC 2445 section 4.3.10 defines the tokens "SECONDLY" / "MINUTELY" / "HOURLY" / "DAILY" / "WEEKLY" / "MONTHLY" / "YEARLY" as possible values for FREQ. hCalendar allows these to be specified in a case-insensitive manner. Parsers *should* convert them to upper-case if exporting as an iCalendar file.
  4. hCalendar recurrance rules *may* use tokens longer than two characters to identify the day. Parsers *must* trim the token down to its first two non-whitespace characters and upper-case them if wishing to convert them to iCalendar BYDAY tokens.
  5. hCalendar recurrance rules *should not* include multiple occurances of "until" or "count" sub-properties, and *should not* specify both an "until" and a "count" sub-property for the same rule. If a rule violates this requirement, parsers *must* use only the first "until" or "count" sub-propetry and *must* ignore subsequent uses of "until" or "count".


Simple hCalendar Event

Here is a sample event in an iCalendar:

SUMMARY:Web 2.0 Conference
LOCATION:Argent Hotel\, San Francisco\, CA

and an equivalent event in hCalendar format with various elements optimized appropriately. See hCalendar Example 1 Steps for the derivation.

<div class="vevent">
 <a class="url" href="http://www.web2con.com/">http://www.web2con.com/</a>
  <span class="summary">Web 2.0 Conference</span>: 
  <abbr class="dtstart" title="2007-10-05">October 5</abbr>-
  <abbr class="dtend" title="2007-10-20">19</abbr>,
 at the <span class="location">Argent Hotel, San Francisco, CA</span>

which could be displayed as:

http://www.web2con.com/  Web 2.0 Conference: October 5- 19, at the Argent Hotel, San Francisco, CA

Note that this is a live hCalendar microformat, which will be found on this page by parsers.

More Complex hCalendar Event

The following example specifies a scheduled meeting that begins at 8:30 AM EST on March 12, 1998 and ends at 9:30 AM EST on March 12, 1998.

     DESCRIPTION:Project XYZ Review Meeting
     SUMMARY:XYZ Project Review
     LOCATION:1CP Conference Room 4350

The equivalent in hCalendar:

<div class="vevent">
<h3 class="summary">XYZ Project Review</h3>
<p class="description"><a href="http://acme.example.com/projects/xyz" rel="tag">Project XYZ</a> Review Meeting</p>
<p>To be held on <abbr class="dtstart" title="1998-03-12T08:30:00-05:00">12 March 1998 from 8:30am EST</abbr> 
until <abbr class="dtend" title="1998-03-12T09:30:00-05:00">9:30am EST</abbr></p>
<p>Location: <span class="location">1CP Conference Room 4350</span></p>
<small>Booked by: <span class="uid">guid-1.host1.com</span> on 
<abbr class="dtstamp" title="19980309T231000Z">9 Mar 1998 6:00pm</abbr></small>

This could be displayed as:

XYZ Project Review

Project XYZ Review Meeting

To be held on 12 March 1998 from 8:30am EST until 9:30am EST

Location: 1CP Conference Room 4350

Booked by: guid-1.host1.com on 9 Mar 1998 6:00pm

Note 1: The product information is not necessary since hCalendar is an interchange format. When transforming hCalendar back into iCalendar, the transforming engine should add its own product ID.

Note 2: A surrounding <span class="vcalendar"> element is optional, and is left out as such. It is optional since the context of a vcalendar is implied when a vevent is encountered. The implied context/scope is that of the document. Authors may explicitly use elements with class="vcalendar" to wrap sets of vevents that all belong to the same calendar, e.g. when publishing multiple calendars on the same page.

Note 3: The version information is unnecessary in hCalendar markup directly since the version will be defined by the profile of hCalendar that is used/referred to in the 'profile' attribute of the <head> element.

Note 4: ISO8601 dates (required by iCalendar) are not very human friendly. In addition, the year is often understood implicitly by humans from the context. Thus <abbr> elements are used to simultaneously provide a human friendly date and/or time in the visible contents of the element, while placing the respective machine parsable comprehensive ISO8601 datetime in the 'title' attribute. The notation YYYY-MM-DDThh:mm:ss should be used for better readability, following the format of RFC 3339.

Note 5: The difference between the DTEND ISO8601 date (2005-10-08) and the human readable date (7) is NOT a mistake. DTEND is exclusive, meaning, that the event ends just before the DTEND. Thus for events which start on one day and end on another day, the DTEND date must be specified as the day after the day that a human would say is the last day of the event.

Note 6: The location in this example contains implicit structure (venue name, city, state) which could be marked up explicitly as an hCard. See hCalendar brainstorming: hCard locations for a informative explanation of how to do this.


Normative References

Informative References

Specifications That Use hCalendar

Related Work

Further Reading

Right now people can do that by publishing .ics files, but it's not trivial to do so, and it's work on the part of other people to look at them. If it's not HTML hanging off our friend's home page that can be viewed in any browser on a public terminal in a library, the bar to entry is too high and it's useless.

Related Pages

This specification is a work in progress. As additional aspects are discussed, understood, and written, they will be added. These thoughts, issues, and questions are kept in separate pages.