IMHO, the stock date pipes are pretty much worthless because the format parameter doesn’t really work unless you’re using Dart. If you don’t mind adding a dependency on moment, it’s trivial to roll your own pipes with it that are more powerful:
import {Pipe, PipeTransform} from 'angular2/core';
import * as moment from 'moment';
@Pipe({
name: 'moment',
pure: false,
})
export class MomentPipe implements PipeTransform {
transform(d:Date | moment.Moment, args?:any[]):string {
let rv = moment(d).format(args[0]);
return rv;
}
}
@Pipe({
name: 'timeago',
pure: false,
})
export class TimeagoPipe implements PipeTransform {
transform(d:Date | moment.Moment):string {
let rv = moment(d).fromNow();
return rv;
}
}
As for your other problem, do you have typings installed?