From: Mike Rylander <mrylander@gmail.com>
Date: Wed, 11 Jul 2018 20:51:59 +0000 (-0400)
Subject: LP#1766716: Adjust date display logic
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=76ff2328fdb1ec5ef1ff19056fb5a610bdda70d8;p=evergreen%2Fequinox.git

LP#1766716: Adjust date display logic

We were using the wrong date formating filter, egDueDate, and additionly the
egOrgDateInContext filter was defaulting to the useless 'shortDate' format in
cases where a format was not passed (such as when $root.egDateAndTimeFormat
can't be found).  Both of these are addressed here.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
---

diff --git a/Open-ILS/src/templates/staff/admin/local/actor/closed_dates.tt2 b/Open-ILS/src/templates/staff/admin/local/actor/closed_dates.tt2
index 1c30d4eaa9..0bb9bec3e7 100644
--- a/Open-ILS/src/templates/staff/admin/local/actor/closed_dates.tt2
+++ b/Open-ILS/src/templates/staff/admin/local/actor/closed_dates.tt2
@@ -61,10 +61,10 @@
     <eg-grid-action label="[% l('Delete closing') %]" handler="delete_aoucd"></eg-grid-action> 
 
     <eg-grid-field label="[% l('Closing Start') %]" flex="1" path="close_start" visible>
-      {{item.close_start | egDueDate:$root.egDateAndTimeFormat:item.org_unit:item._duration}}
+      {{item.close_start | egOrgDateInContext:item._format:item.org_unit:item._duration}}
     </eg-grid-field>
     <eg-grid-field label="[% l('Closing End') %]" flex="1" path="close_end" visible>
-      {{item.close_end | egDueDate:$root.egDateAndTimeFormat:item.org_unit:item._duration}}
+      {{item.close_end | egOrgDateInContext:item._format:item.org_unit:item._duration}}
     </eg-grid-field>
     <eg-grid-field label="[% l('Reason for Closing') %]" flex="2" path="reason" visible></eg-grid-field>
     <eg-grid-field label="[% l('Emergency Closing Processing Summary') %]" flex="2" path="emergency_closing.status" visible>
diff --git a/Open-ILS/web/js/ui/default/staff/admin/local/actor/closed_dates.js b/Open-ILS/web/js/ui/default/staff/admin/local/actor/closed_dates.js
index 78da7fd444..992cde47e2 100644
--- a/Open-ILS/web/js/ui/default/staff/admin/local/actor/closed_dates.js
+++ b/Open-ILS/web/js/ui/default/staff/admin/local/actor/closed_dates.js
@@ -70,6 +70,7 @@ function($scope , $q , $timeout , $location , $window , $uibModal , ngToast ,
             var e = new Date(i.close_end);
             i._duration = ((e - s) / 1000) + 1;
             i._duration = '' + i._duration + ' seconds';
+            i._format = $scope.$root.egDateAndTimeFormat;
 
             if (i.emergency_closing) {
                 var x = i.emergency_closing.status.circulations - i.emergency_closing.status.circulations_complete;
diff --git a/Open-ILS/web/js/ui/default/staff/services/ui.js b/Open-ILS/web/js/ui/default/staff/services/ui.js
index 0368923fb7..6916319993 100644
--- a/Open-ILS/web/js/ui/default/staff/services/ui.js
+++ b/Open-ILS/web/js/ui/default/staff/services/ui.js
@@ -248,7 +248,7 @@ function($timeout , $parse) {
 
     function eg_context_date_filter (date, format, orgID, interval) {
         var fmt = format;
-        if (!fmt) fmt = 'shortDate';
+        if (!fmt) fmt = 'short';
 
         // if this is a simple, one-word format, and it doesn't say "Date" in it...
         if (['short','medium','long','full'].filter(function(x){return fmt == x}).length > 0 && interval) {