Skip to content

A tag to display date and/or time to the user in his preferred format. #2404

@lostmsu

Description

@lostmsu

Considering most web pages now are consumed all around the world, it would make sense to have an HTML-only solution to display some globally specific point in time (relativity jokes aside) to the user in user's preferred format and time zone.

As a server author, I mostly store my timestamps either in UTC, or with timezone info attached. Neither of them would be helpful to a user, who is in a different timezone.

There are two common approaches as to how to solve this simple task right now: server-side rendering, and JavaScript-based rendering.

The biggest disadvantage of the first one is a privacy problem, as it forces the user to expose his timezone to the server. Also, rendering different time for different users negatively affects page caching.

The problem with JavaScript-based approach is, of course, JavaScript. It can be disabled, or accidental errors, which happen elsewhere, might mislead user (e.g. if they end up seeing mixed adjusted and non-adjusted time stamps). Plus, it has to be implemented/properly used almost in every product.

That kind of tag would be useful on almost every website, Facebook, Youtube, and this very page included.

IMHO, <time> tag can be reused for that purpose, if left empty, datetime is set, and some attribute set to a value, describing the desired format of the display. For example, <time datetime='2017-03-02T07:02:20Z' format='date-only'> to show '02-03-2017' to people with French locale. And 'short-time' could show 08:02 for UTC+1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    addition/proposalNew features or enhancementsi18n-trackerGroup bringing to attention of Internationalization, or tracked by i18n but not needing response.needs 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