From 19781ab1b33a2869e8ca8ef3800a40ddb79bf56f Mon Sep 17 00:00:00 2001 From: Ryan Higgins Date: Tue, 19 Aug 2008 13:51:09 -0500 Subject: [PATCH] bug 2530 : create new date object in javascript function instead of modifying passed-in reference. Signed-off-by: Galen Charlton --- .../prog/en/modules/serials/subscription-add.tmpl | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl index 25e2f99393..324221584c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl @@ -42,11 +42,13 @@ function getWeeksArray(startDate,periodicity) { incr=3; } var weeksArray = new Array; - startDate.setDate(1); - startDate.setMonth(0); + var jan01 = new Date(); + jan01.setDate(1); + jan01.setMonth(0); + jan01.setFullYear(startDate.getFullYear()); for(var i=0;i<52;i++) { - weeksArray[i] = formatDate(startDate) + ' ' + weekno_label + (i + 1); - startDate.addDays( 7 ); + weeksArray[i] = formatDate(jan01) + ' ' + weekno_label + (i + 1); + jan01.addDays( 7 ); } return weeksArray; } @@ -1040,7 +1042,8 @@ $('#numberpattern').change( function() { ifFormat : "", button : "next_acqui_button", align : "Tl", - onUpdate : function(cal) { irregular_issues.weeks = getWeeksArray(cal.date); + onUpdate : function(cal) { + irregular_issues.weeks = getWeeksArray(cal.date); irregular_issues.firstissue = cal.date; if(document.irregularity_summary) { irregular_issues.update(); -- 2.39.5