* JSCalendar: fixed week containing 4th Jan is shown as 52th instead 1st week, if week starts on sunday is selected

JSCalendar shows iso8601 week numbers as used eg. in Europe, which are defined for weeks starting on Monday, JSCal used first displayed day (not Monday) to calculate the week number
fix now always uses the Monday to set the week number
US, Canada and middle east uses uses a different week numbering schema than iso8601, which is currently NOT supported by JSCalendar or EGroupware!
This commit is contained in:
Ralf Becker 2011-01-05 02:34:16 +00:00
parent 20db16219d
commit 6e8e8a8986

View File

@ -1111,7 +1111,7 @@ Calendar.prototype._init = function (firstDayOfWeek, date) {
var cell = row.firstChild;
if (this.weekNumbers) {
cell.className = "day wn";
Calendar._setCellText(cell,date.getWeekNumber());
//Calendar._setCellText(cell,date.getWeekNumber());
if (this.hasWeekHandler) cell.caldate = new Date(date);
cell = cell.nextSibling;
}
@ -1120,6 +1120,9 @@ Calendar.prototype._init = function (firstDayOfWeek, date) {
for (var j = 0; j < 7; ++j, cell = cell.nextSibling, date.setDate(date.getDate() + 1)) {
var iday = date.getDate();
var wday = date.getDay();
if (this.weekNumbers && wday == 1) { // iso8601 week number are defined for weeks starting on monday (wday=1)
Calendar._setCellText(row.firstChild,date.getWeekNumber());
}
cell.className = "day";
var current_month = (date.getMonth() == month);
if (!current_month) {