https://github.com/zachleat/humane-dates
Show the difference between a date and now (4 days ago)
https://github.com/zachleat/humane-dates
Last synced: 4 months ago
JSON representation
Show the difference between a date and now (4 days ago)
- Host: GitHub
- URL: https://github.com/zachleat/humane-dates
- Owner: zachleat
- Created: 2010-08-29T16:08:25.000Z (almost 16 years ago)
- Default Branch: master
- Last Pushed: 2014-09-10T21:39:37.000Z (almost 12 years ago)
- Last Synced: 2024-12-19T03:09:57.926Z (over 1 year ago)
- Language: JavaScript
- Homepage: http://www.zachleat.com/web/2008/03/23/yet-another-pretty-date-javascript/
- Size: 6.42 MB
- Stars: 186
- Watchers: 8
- Forks: 24
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
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
```js
humaneDate(new Date);
humaneDate('2008-01-28T20:24:17Z');
```
### jQuery Plugin
```no-highlight
January 1, 2008 20:24:17 GMT
$('span').humaneDates();
$('time').humaneDates();
```
## Tests
To run the full test suite:
```bash
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/