From: Bill Erickson Date: Sun, 26 May 2019 18:01:40 +0000 (-0700) Subject: LP1822414 Angular format service formatValue pipe X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=bd0fd68d7363d5ab81b0453cfbc6874b9477875f;p=evergreen%2Fequinox.git LP1822414 Angular format service formatValue pipe Create a pipe version of FormatService.transform() function so strings may be generated from fields directly in templates. Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/eg2/src/app/core/format.service.ts b/Open-ILS/src/eg2/src/app/core/format.service.ts index d2b2ce51e2..b0e8072a53 100644 --- a/Open-ILS/src/eg2/src/app/core/format.service.ts +++ b/Open-ILS/src/eg2/src/app/core/format.service.ts @@ -108,6 +108,10 @@ export class FormatService { case 'timestamp': const date = new Date(value); + if (Number.isNaN(date.getTime())) { + console.error('Invalid date in format service', value); + return ''; + } let fmt = this.dateFormat || 'shortDate'; if (params.datePlusTime) { fmt = this.dateTimeFormat || 'short';