15 lines
474 B
TypeScript
15 lines
474 B
TypeScript
|
import { Pipe, PipeTransform } from '@angular/core';
|
||
|
import { DatePipe } from '@angular/common';
|
||
|
|
||
|
@Pipe({
|
||
|
name: 'ofUPTime'
|
||
|
})
|
||
|
export class UPTimePipe extends DatePipe implements PipeTransform {
|
||
|
transform(value: any, nullString: string, format = 'mediumDate', timezone?: string, locale?: string): string | null {
|
||
|
if (value == null || value === '' || value !== value) {
|
||
|
return nullString;
|
||
|
}
|
||
|
return super.transform(value, format, timezone, locale);
|
||
|
}
|
||
|
}
|