The HTML <time> element

Sometimes in UI, it requires more brain power to understand “15 hours ago” than “2018-01-10 7:35PM”
https://twitter.com/ghiden/status/951179673072881665

Hidenari has a point. Sometimes our UI could use a bit more precision. We as developers could be a bit more formal. But how to strike the right balance here?

With the HTML5 element, we can include several forms of date-time information in a variety of ways, including:

  1. machine-readable format (datetime attribute)
  2. “tooltip” for the user (title attribute)
  3. shorthand content for the user (text content)

For example:

<time datetime="2018-01-10T19:35:00">
15 hours ago
</time>

Read more about the element at https://www.sitepoint.com/html5-time-element-guide/.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s