From 9660b61158444ed52899cac3aefac5995ec455a0 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 Signed-off-by: Fridolin Somers --- 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.39.5