# time-ago-pipe

> A really simple, lightweight Angular pipe for converting a date string into a time ago

Latest version **1.3.2** (published 2018-02-26) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.2 |
| Published | 2018-02-26 |
| First published | 2016-09-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=4.2.4 |
| Dependencies | 1 |
| Unpacked size | 40.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 127 |
| Author | Andrew |
| Maintainers | andrewpoyntz |
| Keywords | Angular2, timeago, pipe |

## Links

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

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^1.7.1

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 1.3.2 (latest) — 2018-02-26
- 1.3.1 — 2018-02-26
- 1.3.0 — 2018-02-25
- 1.2.1 — 2017-02-08
- 1.2.0 — 2017-02-05
- 1.1.1 — 2016-10-08
- 1.1.0 — 2016-10-08
- 1.0.0 — 2016-09-25
- 0.0.3 — 2016-09-25
- 0.0.2 — 2016-09-25

## README

# time-ago-pipe
[![Build Status](https://travis-ci.org/AndrewPoyntz/time-ago-pipe.svg?branch=master)](https://travis-ci.org/AndrewPoyntz/time-ago-pipe) [![npm](https://img.shields.io/npm/v/time-ago-pipe.svg)](https://www.npmjs.com/package/time-ago-pipe) [![npm](https://img.shields.io/npm/dt/time-ago-pipe.svg?maxAge=25920)](https://www.npmjs.com/package/time-ago-pipe) [![GitHub issues](https://img.shields.io/github/issues/AndrewPoyntz/time-ago-pipe.svg?maxAge=25920?style=plastic)](https://github.com/AndrewPoyntz/time-ago-pipe/issues) [![npm](https://img.shields.io/npm/l/time-ago-pipe.svg?maxAge=25920?style=plastic)](https://github.com/AndrewPoyntz/time-ago-pipe/blob/master/LICENSE)


A really simple, lightweight Angular pipe for converting a date string into a time ago

|Time Range|Output|
|---|---|
|0 - 45 seconds             | a few seconds ago      |
|45 - 90 seconds            | a minute ago           |
|90 seconds - 45 minutes    | X minutes ago          |
|45 - 90 minutes            | an hour ago            |
|90 minutes - 22 hours      | X hours ago            |
|22 - 36 hours              | a day ago              |
|36 hours - 25 days         | X days ago             |
|25 - 45 days               | a month ago            |
|45 - 345 days              | X months ago           |
|345 - 545 days (1.5 years) | a year ago             |
|546 days+                  | X years ago            |
##Installation
```npm install time-ago-pipe --save```

## Usage
It can be imported into your angular project, as you would for any other library. 

In the @NgModule you want to use it in
```
import {TimeAgoPipe} from 'time-ago-pipe';
```
add "TimeAgoPipe" to your declarations
```
@NgModule({
	imports: [... etc ...],
	declarations: [..., TimeAgoPipe, ... ]
})
```
---

In your component templates you can just do:
```
<span>{{your_date | timeAgo}}</span>
```
where "your_date" is a local date string, which could be parsed by the standard Js Date()

If this value is null or not parsable as a date, then the pipe will display nothing

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