Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…

Read the release notes

datetime

A machine-readable date, time or duration on time, del and ins, while the visible text stays human-friendly. VB's data-format-date formats it for you.

Overview

The datetime attribute holds a machine-readable date, time or duration, while the element's text says the same thing for people. Scripts, search engines, feed readers and VB components read the attribute; readers see the text.

Applies to:

  • <time> — dates, times, time-zone offsets, weeks, years and durations.
  • <del> and <ins> — when the change was made: a date, optionally with a time.

Values

On <time> the value must be one of these forms. They are a subset of ISO 8601.

FormExampleMeaning
Year2026The year 2026
Month2026-09September 2026
Date2026-09-2222 September 2026
Yearless date09-2222 September, any year
Week2026-W39Week 39 of 2026
Time14:30, 14:30:15.5A time of day, no date
Local date and time2026-09-22T14:30No time zone
Global date and time2026-09-22T14:30Z, 2026-09-22T14:30-05:00A moment in time, with UTC or an offset
Time-zone offset+05:30An offset on its own
DurationPT1H45M, P3D1 hour 45 minutes; 3 days
Absent (the default) The element's text is parsed instead

On <del> and <ins> only a date, optionally followed by a time, is allowed. A space may replace the T. Durations use P (period) and T before time parts; ISO 8601 durations with years or months (P1Y) are not valid in HTML.

Examples

Dates and times

If the text is already a valid value, datetime can be left off: <time>2026-09-22</time>. Human-friendly text almost never is.

Article dates

Edit timestamps

In Vanilla Breeze

  • data-format-date on a <time datetime> rewrites the text with Intl.DateTimeFormat in the reader's locale (short, medium, long, full) or as relative time (relative, refreshed as time passes). The tooltip is built in: in absolute mode the original text moves to title; in relative mode title holds the exact date and time. An authored title is kept (src/utils/format-date-init.js). Date-only values are formatted in UTC so they never shift a day.
  • data-format-date only handles values JavaScript's Date can parse: years, months, dates and date-times. Durations, time-only, week and offset values are left as written. Do not use it on yearless dates (09-22): some engines parse them as a date in 2001.
  • Components that read time[datetime]: data-sortable sorts table cells by it; <day-view> and <week-view> place events by it; <activity-feed>, <recently-visited> and <comment-thread> use it for relative times; <page-info> reads page dates from it.
  • Styling. Every <time> gets font-variant-numeric: tabular-nums so digits line up in tables and lists (src/native-elements/inline-semantics/styles.css).
  • <del> / <ins> accept VB's data-author, data-reason and data-announce annotations; see the <ins> page.

Accessibility

  • Screen readers read the visible text, not datetime. Make the text clear on its own: "22 September 2026", not "22/09".
  • Relative times ("last week") should have the absolute date available. data-format-date="relative" puts it in title, but title is not reliably exposed to touch or keyboard users, so show the absolute date nearby where it matters.

Gotchas

  • Browsers do not show datetime and do not warn about invalid values. Run an HTML validator.
  • A date-time without Z or an offset is a local time with no zone. Anyone formatting it has to guess the zone; add one for real moments in time.
  • On <del> and <ins>, datetime is for tools and change tracking; nothing displays it.

Related

Which to choose

  • datetime alone — static pages where you write the date text yourself.
  • datetime + data-format-date — dates that should appear in the reader's locale or as relative time, with the exact value in a tooltip.
  • A calendar or feed component — when dates drive layout or sorting; they read the same datetime.
↑