Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Show the difference between a date and now (4 days ago)
branch: master

Merge pull request #11 from knownasilya/patch-1

Update README to use markdown
latest commit 8d3e28a919
Zach Leatherman authored
Failed to load latest commit information.
test https://github.com/freewil/Humane-Dates
.gitignore Removed output directory for tests.
README.md Add title
humane.js https://github.com/freewil/Humane-Dates

README.md

Humane-Dates

A better way to display relative dates using JavaScript. Instead of a raw date string, this script will return strings like "2 hours ago" or "5 days".

Usage

humaneDate(new Date);
humaneDate('2008-01-28T20:24:17Z');

jQuery Plugin

<span title="2008-01-28T20:24:17Z">January 1, 2008 20:24:17 GMT</span>

$('span').humaneDates();

<time datetime="2008-01-28T20:24:17Z">January 1, 2008 20:24:17 GMT</time>

$('time').humaneDates();

Tests

To run the full test suite:

cd test
./test.sh

License

Copyright (c) 2008 Dean Landolt (deanlandolt.com) Re-write by Zach Leatherman (zachleat.com)

Adopted from the John Resig's pretty.js at http://ejohn.org/blog/javascript-pretty-date and henrah's proposed modification at http://ejohn.org/blog/javascript-pretty-date/#comment-297458

Licensed under the MIT license.

See more at http://www.zachleat.com/web/2008/03/23/yet-another-pretty-date-javascript/

Something went wrong with that request. Please try again.