Proposal
Introduce a lightweight HTML element for rendering the user’s current date and time, with simple, human-readable formatting options.
<current-time attr="s,m,h,d,m:text-full,y:full"/>
Idea
The tag prints the live time in the user’s locale, updating every second (or on a specified interval). The attr attribute is a concise format string describing which parts to show and how to style them:
- s, m, h, d, m, y → seconds, minutes, hours, day, month, year
- :text-full → full month/day names (e.g., “September”)
- :text-short → abbreviated names (e.g., “Sep”)
- :2 → zero-padded (e.g., 09)
- :full → four-digit year.
Examples
<!-- 24-hour clock with seconds -->
<current-time attr="h:2,m:2,s:2"/>
<!-- Friendly long date -->
<current-time attr="d,m:text-full,y:full"/>
<!-- Locale-aware month + year -->
<current-time attr="m:text-short,y:full"/>
Accessibility
- Respects user locale/time
- Uses aria-live="polite" so screen readers announce updates unobtrusively
- Degrades gracefully: server can prerender a static timestamp inside the element; a small client script hydrates and starts updates if JS is available.
Why
Authors often reinvent clocks with verbose JavaScript, inconsistent formatting, and poor accessibility. A declarative tag reduces code, improves semantics, and standardizes behavior across sites.
Open questions
Update frequency control, CPU/battery constraints (pause when offscreen), relative time (from-now), and integration with
Top comments (1)
I'm not sure what you're asking?
Some comments have been hidden by the post's author - find out more