From fbf35b49ae65696f85b8f1892e31563935abe78c 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 --- 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 e76de81fd46..1263d3dde8e 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.11.0