Welcome to Vanilla Breeze
This bell pulls live notifications from /go/notify/messages — the same contract documented at /docs/concepts/service-contracts/. Static articles like this one are the no-JS / no-backend fallback.
This bell pulls live notifications from /go/notify/messages — the same contract documented at /docs/concepts/service-contracts/. Static articles like this one are the no-JS / no-backend fallback.
Locale-aware date and relative time formatting via data attributes.
The data-format-date attribute enhances native <time> elements by replacing their text content with a locale-aware formatted date. Supports both absolute date formats and auto-refreshing relative time strings.
<time datetime="2026-02-09" data-format-date>Feb 9, 2026</time>
datetime attribute from the <time> elementtitle attribute (visible on hover)Intl.DateTimeFormat with the specified dateStyle"relative": formats using Intl.RelativeTimeFormat and starts adaptive auto-refreshThe formatting uses the user's browser locale by default.
| Attribute | Type | Description |
|---|---|---|
data-format-date |
string | Date style: "" / "medium" (default), "short", "long", "full", "relative". |
datetime |
string | Standard HTML datetime attribute. Must be a valid date string (ISO 8601 recommended). |
data-format-time |
string | Optional time style: "short", "medium", "long", "full". Ignored when "relative". |
data-locale |
string | Optional locale override (e.g., "de-DE"). Defaults to browser locale. |
title |
string | Set automatically to the original text content (unless already set). Provides hover tooltip. |
data-format-date-init |
boolean | Set automatically to prevent double-binding. Do not set manually. |
Date styles map directly to Intl.DateTimeFormat's dateStyle option:
Default (medium):
Short:
Long:
Full:
<!-- Medium (default) --><time datetime="2026-02-09" data-format-date>Feb 9, 2026</time> <!-- Short --><time datetime="2026-02-09" data-format-date="short">2/9/26</time> <!-- Long --><time datetime="2026-02-09" data-format-date="long">February 9, 2026</time> <!-- Full --><time datetime="2026-02-09" data-format-date="full">Sunday, February 9, 2026</time>
Add data-format-time to include the time component:
<time datetime="2026-02-09T14:30:00" data-format-date="long" data-format-time="short"> February 9, 2026, 2:30 PM</time>
Use data-format-date="relative" for auto-refreshing relative time strings like "3 hours ago" or "in 2 days".
5 minutes ago:
2 hours ago:
Yesterday:
Last week:
In 1 hour:
<time datetime="2026-02-09T10:00:00Z" data-format-date="relative">February 9, 2026</time>
Relative times update automatically on an adaptive schedule:
| Age of timestamp | Refresh interval |
|---|---|
| < 1 hour | Every 60 seconds |
| < 24 hours | Every 5 minutes |
| > 24 hours | Every hour |
Intervals are automatically cleared when elements are removed from the DOM (tracked via MutationObserver).
Use data-locale to force a specific locale for formatting:
German:
Japanese:
<time datetime="2026-02-09" data-format-date="long" data-locale="de-DE">9. Februar 2026</time><time datetime="2026-02-09" data-format-date="long" data-locale="ja-JP">2026年2月9日</time>
Show when events happened in a list:
Alice commented
Bob pushed a commit
Carol opened an issue
<ul> <li> Alice commented <time datetime="..." data-format-date="relative">5 minutes ago</time> </li> <li> Bob pushed a commit <time datetime="..." data-format-date="relative">2 hours ago</time> </li></ul>
Display article or post timestamps:
Published
Elements added to the DOM after page load are automatically enhanced via a MutationObserver. No manual initialization is needed.
<section> <h2>Progressive Enhancement</h2> <p>The <code><time></code> element's original text serves as a fallback when JavaScript is unavailable. Users always see a readable date, with formatting layered on top.</p> <code-block language="html" show-lines label="Fallback text visible without JS" data-escape><time datetime="2026-02-09" data-format-date>Feb 9, 2026</time>
title attribute, accessible on hovercursor: help style hints that additional information is available<time> element with datetime attribute provides machine-readable dates for assistive technology<time> is the enhanced element, keeping the accessibility tree clean