# time-ago

> timeago =======

Latest version **0.2.1** (published 2017-11-28) · 0 weekly downloads

## Install

```sh
npm install time-ago
pnpm add time-ago
yarn add time-ago
bun add time-ago
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2017-11-28 |
| First published | 2013-07-10 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | C Borkert |
| Maintainers | dpweb |
| Keywords | util, nodejs |

## Links

- npm: https://www.npmjs.com/package/time-ago
- Repository: https://github.com/dpweb/time-ago
- Homepage: https://github.com/dpweb/time-ago#readme
- Issues: https://github.com/dpweb/time-ago/issues
- npm.io page: https://npm.io/package/time-ago

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 0.2.1 (latest) — 2017-11-28
- 0.2.0 — 2017-11-28
- 0.1.0 — 2015-01-02
- 0.0.5 — 2013-07-23
- 0.0.4 — 2013-07-20
- 0.0.3 — 2013-07-20
- 0.0.2 — 2013-07-10
- 0.0.1 — 2013-07-10

## README

timeago
=======

Simple timeago function takes same params as 'new Date(...)'

````
var ta = require('./time-ago.js')  // node.js
var ta = timeago();	          // browser
````

###ta.ago(..., [short])
````
ta.ago(new Date()-1000);  =>  "1 second ago"
ta.ago(new Date()-2000);  =>  "2 seconds ago"

ta.ago(1);  =>  "44 years ago"

// takes twitter's created_at date format, in your timezone
ta.ago('Sun Jun 28 19:44:05 +0000 2013'); => "2 days ago"

// and UTC
ta.ago('1997-07-16T19:20+01:00'); => "16 years ago"

// with optional short parameter
ta.ago(new Date()-1000, true);  =>  "1s"
ta.ago(new Date()-1000 * 60, true); => "1m"
ta.ago(new Date()-1000 * 60 * 60, true); => "1h"

````
###ta.today()
````
ta.today() function shows Day, Month, Date, Yr    
 ==> 'Monday, June 1, 1970'    
````

###ta.timefriendly('x period')
````
ta.timefriendly('1 hour')  // convert to ms: seconds, minutes, hours, days, weeks, months, years
 ==> 3600000

 ta.timefriendly('1 hour')  // convert to ms: seconds, minutes, hours, days, weeks, months, years
 ==> 3600000
````

###ta.mintoread(text, [altcmt, wpm])
Cool Medium like 'x min to read' feature
````
ta.mintoread('six hundred words of text')  // calculate based on 200 wpm reading speed
 ==> "3 min to read"

ta.mintoread('six hundred words of text', ' minutes to finish')  // optional alternate comment
 ==> "3 minutes to finish"

ta.mintoread('six hundred words of text', null, 300)  // alternate wpm
 ==> "2 min to read"
````

---
_Source: https://npm.io/package/time-ago · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
