import { NgModule , Pipe , PipeTransform } from '@angular/core' ; import { Locale } from 'date-fns' ; import format from 'date-fns/format' ; import { DateFnsInputDate } from './types' ; import { DateFnsConfigurationService , calculateLocale } from './date-fns-configuration.service' ; import { isValidDate } from './utils' ; @ Pipe ( { name : 'dfnsFormatPure' } ) export class FormatPurePipe implements PipeTransform { constructor ( public config ) { } transform ( date , dateFormat , options ? ) { if ( isValidDate ( date ) ) { return format ( date , dateFormat , calculateLocale ( options , this . config ) ) ; } return '' ; } } @ NgModule ( { declarations : [ FormatPurePipe ] , exports : [ FormatPurePipe ] } ) export class FormatPurePipeModule { }