Skip to content

Proposal: Native Current Date Rendering with the <date> Element #13102

Open

Description

@Vosoone

What problem are you trying to solve?

HTML currently has no native mechanism for dynamically displaying the current local date or its individual components without JavaScript or server-side rendering.

A common example is displaying the current year in a copyright notice:

<footer>Copyright © <date part="year"></date></footer>

Other use cases include displaying the current day, month, or complete date in a specific numeric format, such as DD/MM/YYYY.

These are simple and common requirements, but they currently require JavaScript, server-generated content, or external libraries.

A native HTML solution would make this functionality available directly in markup, simplify static websites, reduce boilerplate, and allow browsers to handle date updates automatically.

What solutions exist today?

Today, authors can display the current date using JavaScript, server-side rendering, or third-party libraries.

For example, JavaScript can generate the current year:

<span id="year"></span>
<script>
  document.getElementById("year").textContent =
    new Date().getFullYear();
</script>

The existing HTML element can represent a specific date or time, but it does not automatically calculate and display the current date.

Server-side rendering can generate the date before the page is delivered, but the displayed value can become outdated if the page remains open across midnight.

These approaches work, but they introduce additional code or infrastructure for a relatively simple presentation requirement. There is currently no standard HTML syntax specifically designed to render the current local date and automatically keep it up to date.

How would you solve it?

I propose introducing a native HTML element with a part attribute that determines which part of the current local date is rendered.

Individual components would be supported:

<date part="day"></date>
<date part="month"></date>
<date part="year"></date>

The element would also support a combined numeric date format:

<date part="DD/MM/YYYY"></date>

For October 19, 2026, the expected output would be:

19/10/2026

Additional formats could include:

<date part="YYYY-MM-DD"></date>
<date part="MM/DD/YYYY"></date>
<date part="DD.MM.YYYY"></date>

When the part attribute is omitted, the element would default to YYYY-MM-DD.

The proposed behavior is as follows:

  • The date is calculated using the user's local time zone and system date.
  • The day and month are rendered as unpadded numbers when requested individually.
  • DD and MM are zero-padded to two digits in combined formats.
  • YYYY represents the four-digit year for years 0000–9999.
  • The element updates automatically when the local calendar date changes, including across local midnight.
  • Changes to the part attribute trigger recalculation.
  • The functionality requires no JavaScript, network request, permission, or page reload.

The initial implementation should use the proleptic Gregorian calendar to ensure predictable numeric output.

If the part attribute contains an unsupported value, the browser should fall back to YYYY-MM-DD without breaking document parsing.

I recognize that introducing a new HTML element may not be the preferred approach. An alternative would be to extend the existing element with equivalent functionality. I would welcome discussion about which approach best fits HTML's existing semantics and design principles.

Anything else?

No response

Activity

  1. myakura commented on Oct 19, 2026

    @myakura

    looks like a dupe of #2404 or #12591 (or both)?

  2. zcorpan commented on Oct 20, 2026

    @zcorpan
    Member

    #12591 doesn't have a "now" feature as far as I can tell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    addition/proposalNew features or enhancementsneeds implementer interestMoving the issue forward requires implementers to express interest

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions