Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {Pipe, ChangeDetectorRef, PipeTransform} from '@angular/core';
- import * as moment from 'moment';
- const momentConstructor: (value?: any) => moment.Moment = (<any>moment).default || moment;
- @Pipe({ name: 'amDateFormat' })
- export class DateFormatPipe implements PipeTransform {
- transform(value: Date | moment.Moment | string | number, ...args: any[]):
- string {
- if (!value) return '';
- return momentConstructor(value).format(args[0]);
- }
- }
Add Comment
Please, Sign In to add comment