Dojo-Timeago is a ported jQuery plugin that makes it easy to support automatically updating fuzzy timestamps (e.g. "4 minutes ago").
JavaScript CoffeeScript Ruby
Pull request Compare This branch is 13 commits ahead, 332 commits behind rmm5t:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
modules
test/unit
timeago
.gitignore
.gitmodules
CNAME
Makefile
README.markdown
Rakefile
clock.png
index.html
package.json

README.markdown

dojo-timeago: ported jQuery plugin

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") from ISO 8601 formatted dates and times embedded in your HTML (à la microformats).

Dojo-Timeago is an attempt to rewrite original Timeago functionality to dojo widgets structure.

Usage

First, load Dojo and the plugin:

<script src="dojo/dojo.js" type="text/javascript"></script>
<script type="text/javascript">
    dojo.require('timeago.Timeago');
</script>

Now, let's attach it to your timestamps in programmatic manner:

<pre>
dojo.ready(function() {
    dojo.query('abbr.timeago').forEach(function(el){
        new timeago.Timeago({}, el);
    });
});
</pre>

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="July 17, 2008">about 1 day ago</abbr>

As time passes, the timestamps will automatically update.

Declarative approach You can also use dojo markup-based widget declaration by adding data-dojo-type attribute:

<abbr class="timeago" data-dojo-type="timeago.Timeago" title="2008-02-27T00:23:00Z">July 17, 2008</abbr>

For more usage and examples: http://timeago.yarp.com/

Author

[Michał Rączka] (https://github.com/michaloo) - ported to dojo

Ryan McGeary (@rmm5t)

Other

MIT License

Copyright (c) 2008-2010, Ryan McGeary (ryanonjavascript -[at]- mcgeary [dot] org)