Eduardo Moniz
Eduardo Moniz

Reputation: 2115

Parsing html5 <time> datetime attribute

i have this element :

<time class="timeAgo" datetime="2011-07-30T13:00:00-03:00">1hour ago</time>

after ~1 minute i would like to update the string inside to like '1hour and 1 minute ago', so the problem is : I cant parse the datetime attribute in internet explorer. And if i cant parse this datetime, i cant compare it to current time to make the time diff i want.

var testTime = new Date( $(".timeAgo").attr('datetime') );

the line above didnt work in IE8.

any ideas to workaround this ?

Upvotes: 4

Views: 1454

Answers (1)

mpen
mpen

Reputation: 282895

Instead of coding this yourself, you can try the timeago jquery plugin.

Upvotes: 1

Related Questions