Categories
Uncategorized

Calculate time ago string in Angular 5

github

import {timeAgo} from './time-ago.ts';
...
// Pass Date Object and it returns a string.
timeAgo(new Date());

You need to pass a date object and this method returns a string. This is compatible with Angular 5.0.3.