Need help in using date-fns with Ionic

import {Injectable, Pipe, PipeTransform} from '@angular/core';
let format = require("date-fns/format");

@Pipe({
  name: 'dateformat'
})
@Injectable()
export class DateFormatPipe implements PipeTransform {
  transform(d: Date | string, fmt: string): string {
    let rv = format(d, fmt);
    return rv;
  }
}

<div class="timestamp">{{post.posted | dateformat:'YYYY年M月D日 HH:mm'}}</div>
2 Likes