timeago

a jQuery plugin

What?

Timeago is a jQuery plugin that makes it easy to support automatically updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). Download, view the examples, and enjoy.

You opened this page sometime before now (turn on javascript, loser). (This will update every minute. Wait for it.)

This page was last modified sometime before now [browser might not support document.lastModified].

Ryan was born Dec 18, 1978.

How?

First, load jQuery and the plugin:

<script src="jquery.min.js" type="text/javascript"></script>
<script src="jquery.timeago.js" type="text/javascript"></script>

Now, let's attach it to your timestamps on DOM ready:

jQuery(document).ready(function() {
  jQuery('abbr[class*=timeago]').timeago();
});

This will turn all abbr elements with a class of timeago and an ISO 8601 timestamp in the title:

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

into something like this:

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

As time passes, the timestamps will automatically update.

Why?

Timeago was originally built for use with Yarp.com (coming soon) to timestamp comments.

Who?

Timeago was built by Ryan McGeary while standing on the shoulders of giants. John Resig wrote about a similar approach. The verbiage was based on the distance_of_time_in_words ActionView helper in Ruby on Rails.

Where?

Download the "stable" release.

The code is hosted on GitHub: http://github.com/rmm5t/timeago. Go on, live on the edge.

When?

Timeago was conceived on July 17, 2008. (Yup, that's powered by timeago too)