diff --git a/src/frontend/plugins/fullDate.pipe.ts b/src/frontend/plugins/fullDate.pipe.ts index 63c9d86eee279956b65b489166bf9ae15e7bb0c1..97d56fa7e6654071b84307191ce5b5656d9e7dfd 100755 --- a/src/frontend/plugins/fullDate.pipe.ts +++ b/src/frontend/plugins/fullDate.pipe.ts @@ -1,5 +1,6 @@ import { Pipe, PipeTransform } from "@angular/core"; import { LANG } from '../app/translate.component'; +import { FunctionsService } from "../service/functions.service"; @Pipe({ name: 'fullDate', @@ -7,10 +8,16 @@ import { LANG } from '../app/translate.component'; }) export class FullDatePipe implements PipeTransform { lang: any = LANG; - constructor() { } + constructor( + public functions: FunctionsService + ) { } transform(value: string) { - const date = new Date(value); - const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric' }; - return this.lang.onRange[0].toUpperCase() + this.lang.onRange.substr(1).toLowerCase() + ' ' + date.toLocaleDateString(this.lang.langISO, options); + if (!this.functions.empty(value)) { + const date = new Date(value); + const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric' }; + return this.lang.onRange[0].toUpperCase() + this.lang.onRange.substr(1).toLowerCase() + ' ' + date.toLocaleDateString(this.lang.langISO, options); + } else { + return ''; + } } } \ No newline at end of file