Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

GMT convert bug? #78

Closed
bluetidepro opened this Issue · 2 comments

2 participants

@bluetidepro

Maybe this is a user issue (aka, my fault) but I'm trying to convert a date "2012-05-10 13:02:00 GMT" by using jQuery.timeago(2012-05-10 13:02:00 GMT) and all I get is NaN years ago?

I'm using this date because it's what the Tumblr API spits out. The Tumblr API allows you use to use "timestamp" - The time of the post, in seconds since the epoch or "date" - The GMT date and time of the post, as a string.

How do I get this to work with the timeago plugin? Do I need to convert that GMT or timestamp before I use the timeago function? I'm lost and don't fully get what I'm doing wrong....

@rmm5t
Owner

@bluetidepro The $.timeago function accepts either a Javascript Date object, a string timestamp in ISO 8601 format, or a micro-format compatibile or <time> DOM element. The string you're currently passing to it is not compatible.

However, I just added support for Timeago to accept a UNIX epoch timestamp in milliseconds (because mills is how JavaScript rolls). Try taking your Tumblr epoch timestamp in seconds, multiplying by 1000, and passing that to $.timeago (v0.11.3).

@rmm5t rmm5t closed this
@bluetidepro

That did the trick! I had tried using timestamp earlier but I just forgot to multiple by 1000. Thanks for the very fast reply! I love the plugin! :)

-Zach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.