Guest User

Untitled

a guest
Jan 22nd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. import {Pipe, ChangeDetectorRef, PipeTransform} from '@angular/core';
  2. import * as moment from 'moment';
  3. const momentConstructor: (value?: any) => moment.Moment = (<any>moment).default || moment;
  4. @Pipe({ name: 'amDateFormat' })
  5. export class DateFormatPipe implements PipeTransform {
  6. transform(value: Date | moment.Moment | string | number, ...args: any[]):
  7. string {
  8. if (!value) return '';
  9. return momentConstructor(value).format(args[0]);
  10. }
  11. }
Add Comment
Please, Sign In to add comment