Question

For some values, timeago is not working in firefox or chrome.

As these values are coming from same DB column, via iterated loop, there is no reason for this difference in behavior.

Here is example of two values for which it works & doesn't.

Javascript

jQuery("time.timeago").timeago(); 

HTML

    <time class='timeago' datetime='Wed Dec 11 07:38:28 GMT 2013'>
        12/11/2013 
    </time>
Actual Output :- 9 days ago


    <time class='timeago' datetime='Thu Dec 19 10:36:53 GMT 2013'>
        12/19/2013 
    </time>
Actual Output :- 12 19 2013

Update:- Changing <time> tag to <abbr> doesn't make any difference. It works for exactly same values as earlier.

Was it helpful?

Solution

The instructions for timeago suggest that you need to use ISO 8601 format for your timestamps:

<abbr class="timeago" title="2008-07-17T09:24:17Z">July 17, 2008</abbr>

<time class="timeago" datetime="2008-07-17T09:24:17Z">July 17, 2008</time>

Also from the instructions:

Are you concerned about time zone support? Don't be. Timeago handles this too. As long as your timestamps are in ISO 8601 format and include a full time zone designator (±hhmm), everything should work out of the box regardless of the time zone that your visitors live in.

I find it odd that it is working for you otherwise in some cases, but you should probably change your timestamp format and see if that resolves your problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top