These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:21 pm Advanced search

The TIME Element

Here you can discuss things related to HTML and the Web in general that do not fit in to other categories.

The TIME Element

Postby RichClark » Thu Feb 05, 2009 9:56 am

Hi guys

I've got a question about using the TIME element in HTML5.

If I was wanting to write 'last january we went to.....' would it be appropriate to wrap 'last january' in a time element?

Code: Select all
<p>.... <time>last january</time> we went to .....</p>


or would you need to add a datetime attribute to it? but this wouldn't be precise enough for the attribute?

Code: Select all
<p>.... <time datetime="01-2008">last january</time> we went to .....</p>


The same applies to Archive, or Category headers/lists in Blogs for example, how would these be marked up?

Code: Select all
<h3>Archives</h3>
<ul>
<li><time>Jan 2009</time></li>
<li><time>Feb 2009</time></li>
</ul>


THanks for your help in advance.

Cheers

Rich
RichClark
<h6>
 
Posts: 4
Joined: Thu Feb 05, 2009 9:44 am
Location: Manchester, UK

Postby brucelawson » Fri Feb 06, 2009 3:49 pm

My reading of the spec is that if there is no datetime attribute, then the contents must be in YYYYMMDD format, not very friendly.

My reading of the spec is that ithe element is for precise dates or times, eg those that can be expressed YYYYMMDD, so "July 08" or "next year" aren't allowed.

Why that should be, I dunno. I can see a need for a table of imprecise dates that could be dynamically sorted by JavaScript

<time datetime="200907">July 2007</time>
brucelawson
<h6>
 
Posts: 1
Joined: Fri Feb 06, 2009 3:36 pm

Postby pigsonthewing » Sat Feb 07, 2009 11:59 pm

brucelawson wrote:<time datetime="200907">July 2007</time>


Excellent example, Bruce - and mirroring the use of dates in microformats; currently achieved most often through abuse of ABBR and for which this HTML 5 element could be an ideal solution, provided all ISO 8601 values are accepted.

Other use cases might be:

Code: Select all
In 1977 nothing happened, but <time datetime="1978">the following year</time>...


or a quote from an original source:

Code: Select all
"In <time datetime="1997">the year of our lord one thousand nine hundred and ninety seven</time>"
Last edited by pigsonthewing on Sun Feb 08, 2009 8:22 pm, edited 1 time in total.
pigsonthewing
<h6>
 
Posts: 3
Joined: Sat Feb 07, 2009 9:57 pm

Postby Rob » Sun Feb 08, 2009 12:33 pm

I didn't look it up but what about the attribute specifying a format for the date? I didn't think this through at all but: <time format="mm:dd:yyyy">July 21, 2009</time> might somehow be useful.
Rob
<h6>
 
Posts: 2
Joined: Mon Jan 26, 2009 11:25 am

Postby pigsonthewing » Sun Feb 08, 2009 8:21 pm

Rob wrote:I didn't look it up but what about the attribute specifying a format for the date? I didn't think this through at all but: <time format="mm:dd:yyyy">July 21, 2009</time> might somehow be useful.


The microformat community rightly rejected this idea, because there are so many ways to write "July", when you tale into account in all the languages of the world, and all their abbreviations.
pigsonthewing
<h6>
 
Posts: 3
Joined: Sat Feb 07, 2009 9:57 pm

Postby RichClark » Mon Feb 09, 2009 9:20 am

Thanks for the suggestions and examples guys, it's definately something to think about.

Can anyone from WhatWg shed any light on if this is currently under consideration?
RichClark
<h6>
 
Posts: 4
Joined: Thu Feb 05, 2009 9:44 am
Location: Manchester, UK

Postby RichClark » Mon Feb 09, 2009 3:15 pm

I have just been looking at this some more and I've come across this - http://www.w3.org/html/wg/markup-spec/#form.data.datetime-local-mdl

I'm not sure if that means that this would now be valid?

Code: Select all
<time date-month="2007-07">July 2007</time>
RichClark
<h6>
 
Posts: 4
Joined: Thu Feb 05, 2009 9:44 am
Location: Manchester, UK

Postby pigsonthewing » Fri Feb 13, 2009 10:59 am

RichClark wrote:
Code: Select all
<time date-month="2007-07">July 2007</time>


That seems redundant; parsers should be able to determine that "2007-07" is a year and a month (per ISO 8601) rather than the author having to say so.

Indeed,

Code: Select all
<time value="2007-07">July 2007</time>


should suffice.
pigsonthewing
<h6>
 
Posts: 3
Joined: Sat Feb 07, 2009 9:57 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest