UNPKG

320 BPlain TextView Raw
1import { Pipe, PipeTransform } from '@angular/core';
2import { Utils } from "./utils";
3
4@Pipe( { name: 'date' } )
5export class DatePipe implements PipeTransform {
6 transform( date: Date, pattern?: string ): string {
7 if (!pattern) {
8 pattern = "yyyy-MM-dd";
9 }
10 return Utils.formatDate(date, pattern);
11 }
12}