Amr Elgarhy
Amr Elgarhy

Reputation: 68912

timeago jquery plugin doesn't work with some dates

I have timeago jquery plugin, and doesn't work with this element date:

<span title="Tue, 28 Jun 2011 19:19:31 GMT" class="time-ago">Tue, 28 Jun 2011 19:19:31 GMT</span>

Also not working with this:

<span title="Tue, 21 Jun 2011 22:53:07 GMT" class="time-ago">Tue, 21 Jun 2011 22:53:07 GMT</span>

======================================================

and in the same time it works fine with this:

<span title="Wed, 29 Jun 2011 23:10:34 GMT" class="time-ago">Wed, 29 Jun 2011 23:10:34 GMT</span>

And this:

<span title="Sat, 25 Jun 2011 20:31:42 GMT" class="time-ago">Sat, 25 Jun 2011 20:31:42 GMT</span>

can't get where is the problem, both dates are valid.

Upvotes: 1

Views: 654

Answers (2)

Ryan McGeary
Ryan McGeary

Reputation: 239914

Author of jquery-timeago here.

As the docs reference, an ISO 8601 timestamp is required for everything to work as expected in timeago:

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

Upvotes: 0

Amr Elgarhy
Amr Elgarhy

Reputation: 68912

I solved this issue by saving dates in the db by UTC, and then while rendering I attache to it a Z char.
So it will be something like this <span class="time-ago">@MyDate.ToString()Z</span>

Upvotes: 1

Related Questions