LP1840950 Patron expiration date & iPads
authorTerran McCanna <tmccanna@georgialibraries.org>
Wed, 20 May 2020 19:33:57 +0000 (15:33 -0400)
committerChris Sharp <csharp@georgialibraries.org>
Tue, 15 Dec 2020 20:15:06 +0000 (15:15 -0500)
This resolves a problem where the patron expiration date was not
displaying when editing a patron account on an iOS device because
Safari did not allow the deprecated Date() function.

This code uses javascript to reformat the date, similar to how the
DOB on the same form is handled.

Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js

index ca7766d..6b23b25 100644 (file)
@@ -763,7 +763,7 @@ angular.module('egCoreMod')
         var patron = egCore.idl.toHash(current);
 
         patron.home_ou = egCore.org.get(patron.home_ou.id);
-        patron.expire_date = new Date(Date.parse(patron.expire_date));
+        patron.expire_date = service.parse_expire_date(patron.expire_date);
         patron.dob = service.parse_dob(patron.dob);
         patron.profile = current.profile(); // pre-hash version
         patron.net_access_level = current.net_access_level();
@@ -877,6 +877,14 @@ angular.module('egCoreMod')
         return new Date(parts[0], parts[1] - 1, parts[2])
     }
 
+    // parse expire date to reformat with correct time zone format_name
+    // TODO: move this into egDate ?
+    service.parse_expire_date = function(expire_date) {
+        if(!expire_date) return null;
+        var timezoneslice = expire_date.slice(0,22) + ":" + expire_date.slice(22,24);
+        return new Date(timezoneslice)
+    }
+
     service.copy_stage_data = function(user) {
         var cuser = service.stage_user;