# hCalendar

**hCalendar** 是一种简单、开放的微格式，用于在网络上发布事件，它在 HTML 中以 1:1 的方式表示 iCalendar 标准（RFC 2445）的 VEVENT 属性与值。它是在 HTML 与 HTML5，以及 Atom、RSS、XHTML 或其他 XML<sup>[1](https://microformats.org/wiki/hCalendar)</sup> 中嵌入机器可读数据的若干开放微格式标准之一。其规范由坦特克·切利克（Tantek Çelik，编辑与作者）和布莱恩·苏达（Brian Suda，作者）编辑与撰写<sup>[1](https://microformats.org/wiki/hCalendar)</sup>。

| 关键事实 | 详情 |
|---|---|
| 基础 | 将 iCalendar（RFC 2445）VEVENT 属性与值 1:1 映射到语义化 HTML<sup>[1](https://microformats.org/wiki/hCalendar)</sup> |
| 根类名 | 日历用 `vcalendar`，事件用 `vevent`；含 `vevent` 但无 `vcalendar` 的文档具有隐含的 `vcalendar` 上下文<sup>[1](https://microformats.org/wiki/hCalendar)</sup> |
| 必需属性 | `dtstart`（ISO 日期）与 `summary`<sup>[1](https://microformats.org/wiki/hCalendar)</sup> |
| 可选属性 | `location`、`url`、`dtend`、`duration`、`rdate`、`rrule`、`category`、`description`、`uid`、`geo`、`attendee`、`contact`、`organizer`、`attach`、`status` 等<sup>[1](https://microformats.org/wiki/hCalendar)</sup> |
| 结束日期规则 | hCalendar 将 `dtend` 声明为包含在内的可见结束日期，不同于 iCalendar 的排他性 DTEND 惯例<sup>[1](https://microformats.org/wiki/hCalendar)</sup> |
| 后继者 | h-event，即 hCalendar 的微格式2更新版，是 microformats.org 的草案规范<sup>[2](https://microformats.org/wiki/h-calendar)</sup> |
| 实测网络存在度 | 在 2013 年 Common Crawl 语料库中，hCalendar 出现于 20,981 个付费级域名和 3,683,002 个 URL，产出 41,683,362 条记录（2 GB）<sup>[3](https://files.ifi.uzh.ch/ddis/iswc_archive/iswc/ab/2014/raw.githubusercontent.com/lidingpku/iswc2014/master/paper/87960273-the-webdatacommons-microdata-rdfa-and-microformat-dataset-series.pdf?raw=true)</sup> |

## 目的与背景

hCalendar 属于微格式运动，该运动随着 Microformats.org 网站在 2005 年 [Supernova](https://www.edgepedia.org/zh/supernova) 大会上揭幕而正式启动。微格式是对标准 HTML 标签的简单扩展，使网页不仅能承载内容的视觉呈现，还能承载其含义：借助事件标记，软件可以把列出的事件添加到个人日程簿，把许多页面中的事件聚合为一份综合日历，或将数据与地图及其他服务结合<sup>[4](https://knowledge.wharton.upenn.edu/article/tantek-celik-and-rohit-khare-the-progress-and-the-promise-of-microformats/)</sup>。

该格式回应了一个具体的发布难题。博主们经常撰写即将发生的事件以及过往事件的回顾，但普通 HTML 所传达的不过是文本格式。通过添加少量结构，发布者就能让蜘蛛与聚合器抓取事件、自动转换为 iCalendar，并在任何 iCalendar 应用中使用，而无需维护单独的日历文件<sup>[1](https://microformats.org/wiki/hCalendar)</sup>。时任 Technorati 首席技术官、Microformats.org 创始人之一的坦特克·切利克如此描述其意图：hCalendar 不是一种新的日历格式，而是让普通网页同时为 Lotus Notes、Microsoft Outlook 和 Apple iCal 等应用编码信息的一种方式<sup>[4](https://knowledge.wharton.upenn.edu/article/tantek-celik-and-rohit-khare-the-progress-and-the-promise-of-microformats/)</sup>。

## 格式

1998 年 11 月发布的 iCalendar 标准 RFC 2445 构成了 hCalendar 的基础<sup>[1](https://microformats.org/wiki/hCalendar)</sup><sup> • </sup><sup>[5](https://www.rfc-editor.org/info/rfc2445/)</sup>。基本技巧是把 iCalendar 的对象名与属性名以小写形式用作 HTML 类名，并将 iCalendar 对象的嵌套直接映射为嵌套的 XHTML 元素<sup>[1](https://microformats.org/wiki/hCalendar)</sup>。

最小事件只标记规范所要求的内容，即 `summary` 与 `dtstart`，置于类为 `vevent` 的元素内：

```html
<span class="vevent">
 <span class="summary">Microformats.org 网站上线</span>
，时间为 <span class="dtstart">2005-06-20</span>
，在 Supernova 大会上
，地点为<span class="location">美国加利福尼亚州旧金山</span>。
</span>
```

<em class="note">就解析而言，`vevent` 与 `vcalendar` 均被视为根类名</em>，因此仅含 `vevent` 元素的页面会被解析为一个隐含日历<sup>[1](https://microformats.org/wiki/hCalendar)</sup>。

日期与时间使用 [ISO 8601](https://www.edgepedia.org/zh/iso-8601)。作者书写日期时可带或不带连字符、冒号与空格，不过 RFC 3339 和 W3C 日期时间注记推荐使用带分隔符的形式；日期与时间之间必须有 `T`，时区既可以用 UTC 偏移给出，如 `2006-01-01T12:00:00-0600`，也可以将值转换为 UTC<sup>[6](https://microformats.org/wiki/hcalendar-faq)</sup>。

### dtend 问题

iCalendar 使用排他性的整日结束日期：DTEND 值必须设为发布者可见地显示为事件结束日期的那一天之后的一天。这一惯例对内容作者来说颇易混淆。hCalendar 规范通过将 `dtend` 属性值明确声明为可见的、包含在内的结束日期来解决此问题；出于这一原因，规范自身的示例从 `2005-10-08` 更正为 `2005-10-07`，并指示各实现采用该解决方案<sup>[1](https://microformats.org/wiki/hCalendar)</sup>。

## 日期时间标记与无障碍性

早期 hCalendar 页面用日期时间设计模式编码机器可读日期，将人类友好的文本包在 `<abbr>` 元素中，其 `title` 属性存放 ISO 8601 值，例如 `<abbr class="dtstart" title="2016-04-21T20:00:00">2016年4月21日星期四晚上8:00</abbr>`<sup>[7](https://microformats.org/wiki/datetime-design-pattern)</sup>。这种用法与盲人用户使用的屏幕阅读器不兼容，这一问题在一项关于 HTML5 结构化数据的学术案例研究中已有记录<sup>[8](https://researchportal.bath.ac.uk/files/9387997/HTML5_Case_Studies_full.pdf)</sup>。

值类模式（value class pattern）是作为替代方案而开发的。它让作者把日期时间拆分为多个 `value` 元素，将人类可读的日期与时间合并为一个机器值：

```html
<span class="dtstart">
    <time class="value" datetime="2008-06-24">本周二</time>
 <time class="value">18:30</time>
</span>
```

这会产出 `dtstart` 值 `2008-06-24 18:30`，iCalendar 转换器将其输出为 `DTSTART:20080624T183000`<sup>[9](https://microformats.org/wiki/value-class)</sup>。正在开发中的 hCalendar 1.0.1 更新纳入了已知勘误更正以及值类模式<sup>[1](https://microformats.org/wiki/hCalendar)</sup>。

## 采用情况

在该格式问世的第一年，采用增长迅速。坦特克·切利克在 Supernova 2006 上报告称，网络上的微格式实体已从一年前的数千个增至数千万个，EVDB 与 Upcoming 的事件和场所都用 hCalendar 与 hCard 进行了标记<sup>[4](https://knowledge.wharton.upenn.edu/article/tantek-celik-and-rohit-khare-the-progress-and-the-promise-of-microformats/)</sup>。Technorati 托管了一个开源转换器，可将 hCalendar 转为 iCalendar 文件，于是一场会议可以把日程发布为普通网页，与会者一键即可将事件添加到笔记本电脑或 PDA 的日历中<sup>[4](https://knowledge.wharton.upenn.edu/article/tantek-celik-and-rohit-khare-the-progress-and-the-promise-of-microformats/)</sup>。

基于爬虫的测量后来量化了其足迹。在 Web Data Commons 2013 从 [Common Crawl](https://www.edgepedia.org/zh/common-crawl) 语料库的提取中，hCalendar 按网站数计是第二常见的微格式，出现于 20,981 个付费级域名和 3,683,002 个 URL，提取出 41,683,362 条记录，占据 2 GB，相比之下 hCard 为 995,258 个域名<sup>[3](https://files.ifi.uzh.ch/ddis/iswc_archive/iswc/ab/2014/raw.githubusercontent.com/lidingpku/iswc2014/master/paper/87960273-the-webdatacommons-microdata-rdfa-and-microformat-dataset-series.pdf?raw=true)</sup>。

## 与其他语法的混用

一个页面可以同时以多种语法承载同一事件。RDFa、微格式与微数据共享相同的基本实体/属性/值模型，因此属性可以相互镜像：W3C《HTML 数据指南》展示了一个 `div` 同时携带 hCalendar 类 `vevent`、微数据 itemtype `http://microformats.org/profile/hcalendar#vevent` 以及 schema.org RDFa 的 `typeof="Event"`<sup>[10](https://www.w3.org/TR/html-data-guide/)</sup>。读取此类页面的消费者应认识到这些数据描述的是单一事件，应合并属性值而非将其视为三个事件，并应优先采用信息最详细的格式<sup>[10](https://www.w3.org/TR/html-data-guide/)</sup>。

## 后继者：h-event

h-event 是 hCalendar 的微格式2更新版。它使用根类 `h-event`，属性名带前缀，如 `p-name`、`dt-start`、`dt-end`、`p-location` 和 `p-summary`，且其所有属性均为可选<sup>[2](https://microformats.org/wiki/h-calendar)</sup>。它是 microformats.org 的草案规范，已可使用并已在实践中实现；为向后兼容，建议发布者同时用经典 hCalendar 类名标记顶层 h-event，例如 `<div class="h-event vevent">`<sup>[2](https://microformats.org/wiki/h-calendar)</sup>。经典 hCalendar 的解析器将 `summary` 映射为 `p-name`，`dtstart` 映射为 `dt-start`，`dtend` 映射为 `dt-end`，而转换为 iCalendar 的 hCalendar 专用实现应优先使用 `p-name` 而非 `p-summary`，以 `p-summary` 作为回退<sup>[2](https://microformats.org/wiki/h-calendar)</sup>。

## References

1. [hCalendar 1.0, Microformats Wiki](https://microformats.org/wiki/hCalendar)
2. [h-event, Microformats Wiki](https://microformats.org/wiki/h-calendar)
3. [The WebDataCommons Microdata, RDFa and Microformat Dataset Series (ISWC 2014)](https://files.ifi.uzh.ch/ddis/iswc_archive/iswc/ab/2014/raw.githubusercontent.com/lidingpku/iswc2014/master/paper/87960273-the-webdatacommons-microdata-rdfa-and-microformat-dataset-series.pdf?raw=true)
4. [Tantek Çelik and Rohit Khare: The Progress and the Promise of Microformats, Knowledge at Wharton (July 20, 2006)](https://knowledge.wharton.upenn.edu/article/tantek-celik-and-rohit-khare-the-progress-and-the-promise-of-microformats/)
5. [RFC 2445: Internet Calendaring and Scheduling Core Object Specification (iCalendar), RFC Editor](https://www.rfc-editor.org/info/rfc2445/)
6. [hCalendar FAQ, Microformats Wiki](https://microformats.org/wiki/hcalendar-faq)
7. [Datetime Design Pattern, Microformats Wiki](https://microformats.org/wiki/datetime-design-pattern)
8. [HTML5 Case Studies: structured data and screen reader compatibility, University of Bath](https://researchportal.bath.ac.uk/files/9387997/HTML5_Case_Studies_full.pdf)
9. [Value Class Pattern, Microformats Wiki](https://microformats.org/wiki/value-class)
10. [HTML Data Guide, W3C](https://www.w3.org/TR/html-data-guide/)

---
*Initially written Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › Web development and web-platform technologies › Web data formats and vocabularies

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/hcalendar

English original: https://www.edgepedia.org/hcalendar
