hoodwink.d enhanced
RSS
2.0
XHTML
1.0

RedHanded

Showing Perfect Time [Perfect Plus Edition] #

by why in bits

Perfect has fallen out of favor. Mike West has gone beyond and I’m bailing as well. I previously ran an article1 showing how to display timestamps in the user’s timezone with a pinkyfingerful of Javascript. He’s retired my <script>..</script> <noscript>..</noscript> nonsense in favor of:

 <span class='PerfectTime' gmt_time='1111396060'>3/21/2005 1:03 CST</span>

And then there’s a half-pint of Javascript in his PerfectTime.js which swaps in the correct time, if the browser is ALL SYSTEMS GO. For a complete examination of his time-wielding skills, see the total exposition.

1 Showing Perfect Time. I’ve updated the article to reflect the new ideas.

said on 13 Feb 2006 at 18:30

Two suggestions: get rid of nobr (use non-breaking space, or CSS for this) and do something clever with non-standard gmt_time attribute. One possible way is to use only class attribute, like class=’PerfectTime1111396060’.

This would help those who like to keep validator happy.

said on 14 Feb 2006 at 02:18

Rimantas: You can always add your own attribute AND keep validator happy.

Here’s how: custom-attribute.html

said on 14 Feb 2006 at 02:23

OK … I don’t get why Mozilla suddenly has problem with that, damn it! :-(

said on 14 Feb 2006 at 04:25

It was pointed out to me that hCalendar solves the syntax problem without the addition of funky attributes. I’ve updated PerfectTime.js to support this format (as well as maintaining yesterday-compatability with the short-lived span format). Tantek would be proud. :)

Rimantas: the format for the output is (in my script) determined when the class is instantiated:

var timeThing = 
    new PerfectTime('%Y-%m-%d %H:%M.%S %Z');

That said, I changed the default in this version… I didn’t like the extra tags either. :)

Comments are closed for this entry.