import { Pipe , PipeTransform } from '@angular/core' ; import { FormatterService } from '@core/formatter.service' ; @ Pipe ( { name : 'sharedDateTime' } ) export class DateTimePipe implements PipeTransform { constructor ( public formatter ) { } param time param minutesOffset { Number } param includeMilliseconds { Boolean } return { string } transform ( time , minutesOffset = 0 , includeMilliseconds = false ) { let date = new Date ( time ) ; if ( isNaN ( date . getTime ( ) ) || ( ! time && time !== 0 ) ) { date = null ; } return this . formatter . dateTime ( date , minutesOffset , includeMilliseconds ) ; } }