rem: var todayDate = parseTimestamp(today,"yyyyMMdd"); cal.set(java.util.Calendar.YEAR,todayDate.getFullYear()); cal.set(java.util.Calendar.MONTH,todayDate.getMonth()); 
add:    cal.set(java.util.Calendar.YEAR,parseInt(today.substring(0,4),10)); cal.set(java.util.Calendar.MONTH,parseInt(today.substring(4,6),10)-1); 
context: function calendar_macro(param) {   // do nothing if there is not a single story :-))   // or if archive of this site is disabled   if (!this.allstories.size() || !this.showArchive())      return;   // define variables needed in this function   var calParam = new Object();   calParam.calendar = "";   var dayParam = new Object();   var weekParam = new Object();   // create new calendar-object   var cal = java.util.Calendar.getInstance(this.getTimeZone(), this.getLocale());   var symbols = this.getDateSymbols();   // render header-row of calendar   var firstDayOfWeek = cal.getFirstDayOfWeek();   var week = "";   var weekdays = symbols.getShortWeekdays();   for (var i=0;i<7;i++) {      dayParam.day = weekdays[(i+firstDayOfWeek-1)%7+1];      week += this.renderSkinAsString("calendardayheader", dayParam);   }   weekParam.week = week;   calParam.calendar = this.renderSkinAsString("calendarweek",weekParam);   cal.set(java.util.Calendar.DATE,1);   // check whether there's a day or a story in path   // if so, use it to determine the month to render   if (path.story)      var today = path.story.day;   else if (path.day)      var today = path.day.groupname;   if (today) {      var todayDate = parseTimestamp(today,"yyyyMMdd");      cal.set(java.util.Calendar.YEAR,todayDate.getFullYear());      cal.set(java.util.Calendar.MONTH,todayDate.getMonth());   }   // cal is now a calendar object set to the first day of the month   // we want to render   // nr. of empty days in rendered calendar before the first day of month appears   var pre = (7-firstDayOfWeek+cal.get(java.util.Calendar.DAY_OF_WEEK)) % 7;   var days = cal.getActualMaximum(java.util.Calendar.DATE);   var weeks = Math.ceil((pre + days) / 7);   var daycnt = 1;   var monthNames = symbols.getMonths();   calParam.month = monthNames[cal.get(java.util.Calendar.MONTH)];   calParam.year =  cal.get(java.util.Calendar.YEAR);   // pre-render the year and month so we only have to append the days as we loop   var currMonth = formatTimestamp(cal.getTime(), "yyyyMM");   // remember the index of the first and last days within this month.   // this is needed to optimize previous and next month links.   var lastDayIndex = 9999999;   var firstDayIndex = -1;   for (var i=0;i<weeks;i++) {      weekParam.week = "";      for (var j=0;j<7;j++) {         dayParam.useskin = "calendarday";         if ((i == 0 && j < pre) || daycnt > days)            dayParam.day = "&nbsp;";         else {            var currGroupname = currMonth+daycnt.format("00");            var linkText = daycnt < 10 ? "&nbsp;"+daycnt+"&nbsp;" : daycnt;            var currGroup = this.get(currGroupname);            if (currGroup) {               var idx = this.contains(currGroup);               if (idx > -1) {                  if  (idx > firstDayIndex)                     firstDayIndex = idx;                  if (idx < lastDayIndex)                     lastDayIndex = idx;               }               dayParam.day =  "<a href=\"" + currGroup.href() + "\">" + linkText + "</a>";            } else {               dayParam.day = linkText;            }            if (currGroupname == today)               dayParam.useskin = "calendarselday";            daycnt++;         }         weekParam.week += this.renderSkinAsString(dayParam.useskin, dayParam);      }      calParam.calendar += this.renderSkinAsString("calendarweek",weekParam);   }   // set day to last day of month and try to render next month   // check what the last day of the month is   // cal.set(java.util.Calendar.DATE, cal.getActualMaximum(java.util.Calendar.DATE));   calParam.back = this.renderLinkToPrevMonth(firstDayIndex,currMonth+"01",monthNames);   calParam.forward = this.renderLinkToNextMonth(lastDayIndex,currMonth+"31",monthNames);   this.renderSkin("calendar",calParam);}
meta: 993	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/993/21aaf428391e4d15f4f31c47b17b58a38f014ee7/macros.js/clean/code/Site/macros.js