6

I have a web application I am writing the HTML for. In the app I will be displaying a lot of dates and in HTML5 they added a <time> tag. If I wrap all of my dates and times in the <time> tag what will be the end result for the user? Do any browsers style it different? Are there any screen readers or plugins which will interact with it? I know it is supposed to make the dates easily machine readable, but what is the computer going to do with it? I am not really sure what benefit this will have to the user experience and the usability/accessibility of the site.

UPDATE: I checked gCal and it is not using the <time> tag anywhere. Does this mean it is not worth the time and money making the back-end code automatically wrap all dates/time in this tag?

5

The time element is a machine-readable element. So it is mainly used to help out the computer not the user directly.

https://css-tricks.com/time-element/

The element in HTML represents a machine-readable date, time, or duration. It can be useful for creating event scheduling, archiving, and other time-based functions.

and

The uses of unambiguous dates in web pages aren’t hard to imagine. A browser could offer to add events to a user’s calendar. A Thai-localised browser could offer to transform Gregorian dates into Thai Buddhist era dates. A Japanese browser could localise 16:00 to "16:00時". Content aggregators can produce visual timelines of events.

Search engines can produce smarter search results. ...

  • exactly. Also, to add to the answer since it's part of the question, it doesn't render differently (so the user won't notice anyhting), BUT you can make it render as you wish by simply styling the time tag, so it's a semantic way to modify styles as well – Devin Jun 30 '16 at 18:22
  • @Devin I wanted to say something like that but then I wondered if this tag is what highlights/"makes into links" times and dates on mobile phones, hence making it display a bit differently. Like this – DasBeasto Jun 30 '16 at 18:29
  • not necessarily. I have seen this behavior even without the ´time´ tag, so mobile browsers tend to detect it in some way. However, it's true that having the tag would allow you to style as you wish rather than leaving to pure browser rendering. – Devin Jun 30 '16 at 18:37
  • In the answer above it talk about what a browser could do. Is there any concrete evidence that the browser or search engines actually do anything with it? I know I could style it but I could do the same thing with a class. – Eric Jun 30 '16 at 18:42
  • 1
    Another example usage is that is helps scrapers like my article reading extension to find the correct date – Zach Saucier Jun 30 '16 at 21:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.