From 3db68bc70459366d80098735c273bb0a61225066 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 0d2884eaf1..81e7ddd161 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; } @@ -1042,7 +1044,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