From 9548eb66b0503e472c4df621fc01466d5c82efe4 Mon Sep 17 00:00:00 2001 From: Agustin Moyano Date: Tue, 31 Mar 2020 17:56:22 -0300 Subject: [PATCH] Bug 24980: (follow-up) return '' when date is null --- koha-tmpl/intranet-tmpl/prog/en/includes/js-date-format.inc | 2 ++ koha-tmpl/opac-tmpl/bootstrap/en/includes/js-date-format.inc | 2 ++ 2 files changed, 4 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/js-date-format.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/js-date-format.inc index 5ca8f77860..17fa438509 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/js-date-format.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/js-date-format.inc @@ -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); diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/js-date-format.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/js-date-format.inc index 21301d75bc..643cda065b 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/js-date-format.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/js-date-format.inc @@ -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); -- 2.25.0