Duration is a jQuery plugin that makes it easy to support automatically updating durations (e.g. "4 minutes" or "1 hour").
JavaScript
Pull request Compare This branch is 7 commits ahead, 321 commits behind rmm5t:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lang
test
.gitignore
README.markdown
jquery.duration.js

README.markdown

duration: a jQuery plugin

Duration is a jQuery plugin that makes it easy to convert numerical durations (milliseconds) into a sentence (e.g. "4 minutes" or "1 day").

It was forked from timeago.jquery.js plugin.

Usage

First, load jQuery and the plugin:

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

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

   $(document).ready(function() {
     $("abbr.duration").duration();
   });

This will turn all abbr elements with a class of duration and a duration in the title:

<abbr class="duration" title="1000">1000</abbr>

into something like this:

<abbr class="duration" title="1000">1 second</abbr>

For different language configurations: see lang folder

Author

Loïc Guillois (@loic_guillois)

Other

MIT License

Copyright (c) 2012, Loïc Guillois (contact -[at]- loicguillois [dot] fr)