1hour ago after...">

Parsing html5 <time> datetime attribute

i has 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 line inside to like “1 hour and 1 minute ago,” so the problem is this: I cannot parse the datetime attribute in Internet Explorer. And if I cannot parse this datetime, I cannot compare it with the current time to make the time I want.

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

The line above did not work in IE8.

any ideas to solve this problem?

+4
source share
1 answer

Instead of encoding it yourself, you can try the timeago jquery plugin .

+2
source

All Articles