From Microformats Wiki
Revision as of 06:27, 27 August 2009 by Tantek (talk | contribs) (drafted)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


An hCalendar 1.0 issue.


The hCalendar 1.0 dtend property as of hCalendar 1.0 requires that end *dates* be marked up as occuring a whole day after what people typically consider the end date of an event.

E.g. if a conference starts on 2010 March 12th and ends 2010 March 16th, then the dtend must be marked up with the value of "2010-03-17" - seemingly a whole day after the end of the conference. hCalendar suggests obscuring this disparity between the human visible end date and the machine specified date using the <abbr> tag:

<div class="vevent">
 <span class="summary">a conference</span>
 starts on <span class="dtstart">2010-03-12</span>, and
 ends on <abbr class="dtend" title="2010-03-17">2010-03-16</abbr>.

This is due to hCalendar being originally specified with the same semantics as iCalendar, which places that requirement on the DTEND property of the VEVENT object.


This is problematic for several reasons:

  • Appears inconsistent. It is odd that the value specified for machine consumption is different than the value specified for human consumption - regardless of format/syntax - and appears inconsistent to anyone who sees the tooltip, or views and copy/pastes the source. It looks like a bug or mistake, and in fact has been errantly "corrected" as such (e.g. even in the hCalendar spec itself).
  • Unintuitive for authoring. When authors are writing up the end date for an event, they write up what a human expects to see - the last day of the event. It is an unintuitive leap to think to specify +1 day for machine consumption, and an additional cognitive load (in order to get it right).
  • Semantic abuse of abbr. An abbr's title attribute provides an expansion for the inner text. In no way is a +1 date an expansion of a date, it appears more like a completely different value.
  • Required DRY violation. While the dtstart in the above example is specified only once, readable to both humans and machines, the dtend must be specified twice, once for humans, and once for machines, thus requiring a particularly bad DRY (Don't Repeat Yourself) violation, that of requiring data be specified twice, but slightly different in one instance than another, thus increasing the chances of duplication based errors even more (since verifiability is more difficult).
    • Prevents use of simple markup As a result of the forced DRY violation, it is not possible to use simple markup like <span class="dtend">2010-03-16</span> because while a human reads that as an event that ends on the 16th, an hCalendar 1.0 processor will read that as an event that ended the day before, on the 15th.

possible solutions

As noted in the issue description on the hCalendar issues page, there are a few possible solutions.

  • new hCalendar 1.0.1 property for end dates. As noted in the first resolution of the issue, we could introduce a new property, dtlast which authors would use to specify the last day of an event, instead of dtend.
    • Advantage: Maintains iCalendar conceptual compatibility for DTEND values.
    • Advantage: Compatibility with existing hCalendar 1.0 content that just happened to get the end date +1 distinction right.
    • ... any other advantages?
    • Disadvantage: Increased vocabulary. dtlast is a new term, even if it is not new functionality. Essentially this puts additional burden on authors.
    • Disadvantage: Increased complexity/confusion. When to use dtend vs. dtlast? hCalendar authors would now have to remember, use dtend for end *times* and dtlast for end *dates*. More explanation of the additional burden on authors.
    • ... any other disadvantages?
  • redefine hCalendar 1.0.1 dtend to be inclusive for whole dates. This is a bit more radical.
    • Advantage: Zero impact on vocabulary.
    • Advantage: No increase to hCalendar authoring complexity.
    • Advantage: Will reflect dominant use of dtend in examples in the wild (more research and citations needed to back this up!). In other words, authors have ALREADY been using dtend assuming it works this way (inclusive end dates), and will actually be surprised to find out that it doesn't. Making this change to DTEND semantics may actually reflect hCalendar publishing reality more than keeping the precise iCalendar DTEND semantic. Examples of inclusive dtend usage in the wild:
      • http://barcamp.org/ - BarCamp wiki, dates for BarCamps
      • microformats.org/wiki/events/ - several multi-day event listings, as recently as Glenn Jones (who himself is a very knowledgable and prolific microformats developer) event page for SXSW 2010 use inclusive DTENDs (notably, using a span element that does NOT duplicate content).
      • draft of Emily Lewis' book Microformats Made Simple, uses dtend for inclusive end dates.
      • ... more instances of existing use of DTEND for *inclusive* end dates.
    • ... any other advantages?
    • Disadvantage: Redefines DTEND to be *slightly* different from how it is defined in iCalendar. This may lead to errors on the part of developers.
      • Mitigation: it may be possible to mitigate this disadvantage by providing both very precise hCalendar to iCalendar processor conformance requirements, and sufficient test cases for hCalendar to iCalendar processors for them to get this correct in their code.
    • Disadvantage: breaking some amount of existing hCalendar content on the web (research (research needed to determine the extent of the problem)
      • Workarounds: Based on aforementioned research, workarounds may be possible, e.g. heuristics for when abbr is used similar to the example at the top of the page, to detect "off by one" cases and accommodate accordingly). Make it an explicit error for the human visible date to be different than the machine parsed date, and state specific error handling rules for hCalendar processors that "repair" this problem.
    • ... any other disadvantages?
  • ... other possible solutions?


This issue was raised to me (Tantek) in person pretty much since the first time I gave such an example back in 2004, was something I had to explicitly cover and point out in nearly every microformats presentations I gave, was eventually pointed out on the microformats discuss mailing list (citation needed), and eventually explicitly documented as an issue on the wiki hCalendar issues page by Andy Mabbett on 2007-01-20.

see also