Closed Abhivendra closed 7 years ago
This repo is for timezone shifts only. I think you need ask it in https://github.com/urish/angular2-moment - There's everything about moment namespace. Anyway, I see there are no solution for you right now. You can write your own pipe for it by yourself.
Something like following code:
import {Pipe, PipeTransform} from "@angular/core";
import * as moment from "moment-timezone";
@Pipe({
name: 'amFromNow'
})
export class FromNowPipe implements PipeTransform {
transform(value: moment.MomentInput, withoutSuffix: boolean = false): string {
return moment(value).fromNow(!!withoutSuffix);
}
}
How to use:
<span>{{ momentValue | amFromNow }} </span> <!-- With 'ago' suffix -->
<span>{{ momentValue | amFromNow:true }} </span> <!-- Without it -->
I want to use moment.fromNow() in the angular material table in my template. How to do it?