LP1834662 Allow date format defaults to persist.
authorBill Erickson <berickxx@gmail.com>
Fri, 5 Jul 2019 18:21:49 +0000 (14:21 -0400)
committerBill Erickson <berickxx@gmail.com>
Mon, 26 Aug 2019 15:47:38 +0000 (11:47 -0400)
Avoid clobbering the default date / time format strings set by the
FormatService.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Open-ILS/src/eg2/src/app/staff/resolver.service.ts

index 2c94ec7..94b469e 100644 (file)
@@ -133,9 +133,17 @@ export class StaffResolver implements Resolve<Observable<any>> {
             'ui.staff.max_recent_patrons',
             'ui.staff.angular_catalog.enabled' // navbar
         ]).then(settings => {
-            this.format.wsOrgTimezone = settings['lib.timezone'];
-            this.format.dateFormat = settings['webstaff.format.dates'];
-            this.format.dateTimeFormat = settings['webstaff.format.date_and_time'];
+            // Avoid clobbering defaults
+            if (settings['lib.timezone']) {
+                this.format.wsOrgTimezone = settings['lib.timezone'];
+            }
+            if (settings['webstaff.format.dates']) {
+                this.format.dateFormat = settings['webstaff.format.dates'];
+            }
+            if (settings['webstaff.format.date_and_time']) {
+                this.format.dateTimeFormat =
+                    settings['webstaff.format.date_and_time'];
+            }
         });
     }
 }