Skip to content
Snippets Groups Projects
Commit b843b4c4 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #12091 TIME 0:05 fix empty full date

parent 80819b05
No related branches found
No related tags found
No related merge requests found
import { Pipe, PipeTransform } from "@angular/core"; import { Pipe, PipeTransform } from "@angular/core";
import { LANG } from '../app/translate.component'; import { LANG } from '../app/translate.component';
import { FunctionsService } from "../service/functions.service";
@Pipe({ @Pipe({
name: 'fullDate', name: 'fullDate',
...@@ -7,10 +8,16 @@ import { LANG } from '../app/translate.component'; ...@@ -7,10 +8,16 @@ import { LANG } from '../app/translate.component';
}) })
export class FullDatePipe implements PipeTransform { export class FullDatePipe implements PipeTransform {
lang: any = LANG; lang: any = LANG;
constructor() { } constructor(
public functions: FunctionsService
) { }
transform(value: string) { transform(value: string) {
const date = new Date(value); if (!this.functions.empty(value)) {
const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric' }; const date = new Date(value);
return this.lang.onRange[0].toUpperCase() + this.lang.onRange.substr(1).toLowerCase() + ' ' + date.toLocaleDateString(this.lang.langISO, options); 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment