import { Pipe, PipeTransform } from '@angular/core';
import { DatePipe } from '@angular/common';
@Pipe({name: 'simpleDate'})
export class SimpleDatePipe implements PipeTransform {
transform(value: Date): string {
let datePipe = new DatePipe("en-US");
let revamp = datePipe.transform(value, 'MM/dd/yy');
return revamp;
}
}
Remember to loop the pipe in at declarations at the module wrapping the component where you want to use this guy. Maybe also put it in providers if you want to use it in TypeScript.
No comments:
Post a Comment