From 5ddd28bba796ddded841e08163f8a16fb537ee0b Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Thu, 18 Feb 2021 13:50:38 +1300 Subject: [PATCH] Bug 14242: (follow-up) Format copyright date before plugged into form This patch formats the copyright date so that only the year shows before plugging the formatted version into the form. Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer Signed-off-by: Katrin Fischer --- koha-tmpl/opac-tmpl/bootstrap/js/autofill.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/autofill.js b/koha-tmpl/opac-tmpl/bootstrap/js/autofill.js index e76de81fd4..1263d3dde8 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/autofill.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/autofill.js @@ -103,6 +103,15 @@ if( ! field.$target ) continue; + /* format copyrightdate */ + if ( field.target == 'copyrightdate' ) { + if ( value.indexOf('-') > -1 ) { + var hyphenIndex = value.indexOf('-'); + var newval = value.slice(0, hyphenIndex); + value = newval; + } + } + /* handle differently depending on datatype */ switch(typeString(value)) { case 'array': -- 2.30.2