Bug 24980: (follow-up) return '' when date is null
authorAgustin Moyano <agustinmoyano@theke.io>
Tue, 31 Mar 2020 20:56:22 +0000 (17:56 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 1 May 2020 07:14:34 +0000 (08:14 +0100)
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

koha-tmpl/intranet-tmpl/prog/en/includes/js-date-format.inc
koha-tmpl/opac-tmpl/bootstrap/en/includes/js-date-format.inc

index 64c8e8f..3dae094 100644 (file)
@@ -32,6 +32,7 @@
          * as well as a 'withtime' boolean denoting whether to include time or not in the output string.
          */
         window.$date = function(value, options) {
+            if(!value) return '';
             var tz = (options&&options.tz)||def_tz;
             var m = moment(value);
             if((m.creationData().format !== 'YYYY-MM-DD')&&tz) m.tz(tz);
@@ -55,6 +56,7 @@
         };
 
         window.$time = function(value, options) {
+            if(!value) return '';
             var tz = (opitons&&options.tz)||def_tz;
             var m = moment(value);
             if(tz) m.tz(tz);
index 21301d7..643cda0 100644 (file)
@@ -31,6 +31,7 @@
          * as well as a 'withtime' boolean denoting whether to include time or not in the output string.
          */
         window.$date = function(value, options) {
+            if(!value) return '';
             var tz = (options&&options.tz)||def_tz;
             var m = moment(value);
             if((m.creationData().format !== 'YYYY-MM-DD')&&tz) m.tz(tz);
@@ -54,6 +55,7 @@
         };
 
         window.$time = function(value, options) {
+            if(!value) return '';
             var tz = (opitons&&options.tz)||def_tz;
             var m = moment(value);
             if(tz) m.tz(tz);