

Show HN: sortByTimeAgo.js - A jQuery plugin I'm working on to sort by time ago. - cjstewart88
https://github.com/cjstewart88/sortByTimeAgo

======
ibejoeb
Out of curiosity, what third-party APIs are you using that return "time ago"
attributes but no standard date attribute (e.g, ISO 8601, RFC 822)? I hope
never to have that misfortune. This would be great for scraping, though.

~~~
cjstewart88
This is the API that made me do it:
<http://api.ihackernews.com/page?format=jsonp> I was using it along with
reddits api to sort posts together on this website,
<http://www.hackerreads.com/>.

------
dangrossman
Thanks for sharing this. But why is it a jQuery plugin? It's a single function
that iterates over an array, just as suited for a library or node.js module as
a webpage; a dependency on a DOM library seems out of place.

~~~
gbraad
Seems to be a wrong approach to me. Instead of using a timestamp it is sorted
against 'English' indexof-ed strings. I would expect human-readable date
formats are done afterwords on the sorted array itself, which would be a
simple compare check.

It is jQuery specific since it uses $.each

~~~
cjstewart88
I would never make an API that returns time ago and force my users to sort
that way. This was made because:
<http://api.ihackernews.com/page?format=jsonp>

~~~
gbraad
Had never seen this unofficial API. Ugh, postedAgo?! Should be a timestamp...
As he mentions, it should be avail. Ask ronneroller to change/add it ;-)

