Role and semantics
Section titled “Role and semantics”DateTimeText is a <time> element; its datetime attribute holds the ISO 8601 value. Screen readers read the visible text.
Keyboard
Section titled “Keyboard”DateTimeText takes no focus.
None.
Screen reader output
Section titled “Screen reader output”| Example | Output |
|---|---|
datetime |
“8 Oct 2026, 14:30” |
relative |
“2 hours ago” |
Relative time refreshes are not announced, so the page does not keep talking.
Contrast
Section titled “Contrast”The text takes its colour from its surroundings, which keep their text contrast.
WCAG 2.2
Section titled “WCAG 2.2”| Criterion | How DateTimeText meets it | What product teams must do |
|---|---|---|
| 1.3.1 Info and relationships | A machine-readable value with <time datetime>. |
— |
| 3.1.2 Language of parts | The format follows the Provider language. | Match the Provider language to the page language. |
title is seen only with a mouse; if the exact time matters, use an exact format instead of relative.