import { Pipe, PipeTransform } from '@angular/core';
import * as moment from 'moment';

/**
 * Generated class for the TimeagoPipe pipe.
 *
 * See https://angular.io/docs/ts/latest/guide/pipes.html for more info on
 * Angular Pipes.
 */
@Pipe({
  name: 'timeago',
})
export class TimeagoPipe implements PipeTransform {
  now: any;

  transform(value: string, ...args) {
    this.now = moment(value).fromNow(true);
    return this.now;
  }
}
