https://github.com/falm/number-timeago
A number timeago package support 2..years.ago() method
https://github.com/falm/number-timeago
Last synced: 9 months ago
JSON representation
A number timeago package support 2..years.ago() method
- Host: GitHub
- URL: https://github.com/falm/number-timeago
- Owner: falm
- License: mit
- Created: 2016-05-20T08:54:24.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-09-03T02:01:42.000Z (almost 10 years ago)
- Last Synced: 2025-03-30T09:15:58.795Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 112 KB
- Stars: 13
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# number-timeago [](https://travis-ci.org/falm/number-timeago)
> A number timeago package support 2..years.ago() method
## Install
```bash
$ npm install number-timeago
```
It's also available on NPMCDN https://unpkg.com/number-timeago@0.1.1/number.timeago.js
## Usage
**Node.js CommonJS**
```js
require("number-timeago")();
```
**AMD**
```js
require(['number-timeago'], function (NumberTimeAgo) {
NumberTimeAgo();
});
```
then
```js
// seconds
20..seconds // => 20,000 milliseconds
// minutes
10..minutes // => 600,000 milliseconds
// weeks, days, months, years so on
// time ago
2..months.ago() // will return 2 months ago Date object
// => Mon Mar 28 2016 11:46:07 GMT+0800 (CST)
```
## License
MIT © [Falm](https://github.com/falm)