angular-timesince

Returns the number of seconds, minutes, days, months or years for a Date object from the current system time
1 person uses it
Author: 6976199?v=3 thisissoon
Submitted by: 7836746?v=4 edoparearyee

Angular TimeSince

Build Status Coverage Status

A simple lightweight library for Angular (2/4+) which removes excess text and add timesince symbol to end of text before text overflows container.

This is a simple library for Angular, implemented in the Angular Package Format v4.0.

Install

npm i @thisissoon/angular-timesince --save

app.module.ts

` import { TimeSinceModule } from '@thisissoon/angular-timesince';

@NgModule({ imports: [ TimeSinceModule ] }) export class AppModule { } `

Example

app.component.html

<p>{{ date | timeSince }} ago</p>

app.component.ts

Use any Date object or Date parsable value

export class AppComponent { date = new Date("2010-08-24T16:16:09.540Z"); // or // date = "2010-08-24T16:16:09.540Z" }

comments powered by Disqus
This page was last updated 4 months ago.