import { Pipe } from '@angular/core' ; import * as moment from 'moment' ; /**
 reference: https://www.dunebook.com/create-a-commenting-application-with-angular-2
 to use:
 <div>
    {{someDateObject | fromNow}}
 </div>
 **/ @ Pipe ( { name : 'fromNow' } ) export class FromNow { transform ( value ) { if ( value && ( value instanceof Date || typeof value === 'number' ) ) { return moment ( value ) . fromNow ( ) ; } } }