import { Pipe, PipeTransform } from '@angular/core'; import * as moment from 'moment/moment'; @Pipe({ name: 'momentFormat' }) export class MomentFormatPipe implements PipeTransform { transform(value: any, format: string): string { return moment(value).format(format); } }