WHATWG HTML5 Forums Forum Index WHATWG HTML5 Forums
A Forum for HTML5 Discussions: Semantics, DOM APIs, Microdata, Canvas, WebGL, Offline Web Applications, Local Storage, WebM Video, WebSockets, Web Workers, HTML5 Drag and Drop, HTML5 Forms, Accessibility, Syntax, News, Keywords, Yet More Keywords & More.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The TIME Element

 
Post new topic   Reply to topic    WHATWG HTML5 Forums Forum Index -> General
View previous topic :: View next topic  
Author Message
RichClark
<small>


Joined: 05 Feb 2009
Posts: 4
Location: Manchester, UK

PostPosted: Thu Feb 05, 2009 9:56 am    Post subject: The TIME Element Reply with quote

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:
<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:
<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:

<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
Back to top
View user's profile Send private message
brucelawson
<small>


Joined: 06 Feb 2009
Posts: 1

PostPosted: Fri Feb 06, 2009 3:49 pm    Post subject: Reply with quote

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>
Back to top
View user's profile Send private message
pigsonthewing
<small>


Joined: 07 Feb 2009
Posts: 3

PostPosted: Sat Feb 07, 2009 11:59 pm    Post subject: Reply with quote

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:
In 1977 nothing happened, but <time datetime="1978">the following year</time>...


or a quote from an original source:

Code:
"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
Back to top
View user's profile Send private message
Rob
<small>


Joined: 26 Jan 2009
Posts: 2

PostPosted: Sun Feb 08, 2009 12:33 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
pigsonthewing
<small>


Joined: 07 Feb 2009
Posts: 3

PostPosted: Sun Feb 08, 2009 8:21 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
RichClark
<small>


Joined: 05 Feb 2009
Posts: 4
Location: Manchester, UK

PostPosted: Mon Feb 09, 2009 9:20 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
RichClark
<small>


Joined: 05 Feb 2009
Posts: 4
Location: Manchester, UK

PostPosted: Mon Feb 09, 2009 3:15 pm    Post subject: Reply with quote

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:
<time date-month="2007-07">July 2007</time>
Back to top
View user's profile Send private message
pigsonthewing
<small>


Joined: 07 Feb 2009
Posts: 3

PostPosted: Fri Feb 13, 2009 10:59 am    Post subject: Reply with quote

RichClark wrote:
Code:
<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:
<time value="2007-07">July 2007</time>


should suffice.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    WHATWG HTML5 Forums Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group