From bd0fd68d7363d5ab81b0453cfbc6874b9477875f Mon Sep 17 00:00:00 2001
From: Bill Erickson <berickxx@gmail.com>
Date: Sun, 26 May 2019 11:01:40 -0700
Subject: [PATCH] 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 <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
---
 Open-ILS/src/eg2/src/app/core/format.service.ts | 4 ++++
 1 file changed, 4 insertions(+)

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';
-- 
2.11.0