Re: Date Fields in HTML

James Brown / 2003-06-03 15:31:

> Again, thank you very much for your input.  I wasn't aware that a universal
> date format had been adopted, and I'm very glad that the one that has been

Well, I didn't say it was adopted, only that it's official. It's 
pretty much like how W3C releases official recommendation but 
(X)HTML authors usually fail to comply with it. Only, this time the 
specification is defined by government but it doesn't seem to matter 
at all... at least here in Finland.

> <date time="2002-11-19T13:24:38+02:00" format="short-date">19/11/2002</date>
> 
> Where the "time" attribute is the date and time value that the coder is
> wanting to represent in the ISO standard format, where "format" is the type
> of date display that the coder is wanting to show, and where the value
> between the <date></date> tags provides a version of the date for users with
> a browser that doesn't support the <date> tag.
> 
> In the example above, the browser would convert the value from the "time"
> attribute to the users preferred short-date format.
> 
> Mikko - you mentioned something about using CSS instead of HTML.  I'm
> certainly not an expert in CSS (although I do use it).  Do you think this
> idea would be more suitable as a CSS attribute?

I feel that the way the date is formatted shouldn't be specified in 
the (X)HTML source. That's why I feel that we don't need "format" 
attribute at all. If you need to format some "date" elements 
differently from default you can use "class" attribute instead and 
use imaginary CSS like:

date.brief { content: format-date-as("%d/%m/%Y",attr(time)); }

Of course, we don't have the required CSS functionality yet, but if 
dynamic reformatting is considered important it should be done with 
CSS instead of some special attribute for some specific element. 
This way the user can override rendering of date and changing date 
display for an entire site is much easier because you only need to 
change the CSS file. In addition, one can use similar date rendering 
in any generic XML languages styled with CSS.

-- 
Mikko

Received on Tuesday, 3 June 2003 15:01:54 UTC