time-ago-pipe
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:
```
{{yourdate | timeAgo}}
```
where "yourdate" 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