Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

GMT convert bug? #78

Closed
bluetidepro opened this Issue May 16, 2012 · 2 comments

Comments

Projects
None yet
2 participants

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....

Owner

rmm5t commented May 16, 2012

@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 May 16, 2012

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