Open GoogleCodeExporter opened 8 years ago
I made debug. The sdf function, which calculate shift, is so:
var sdf = function (n) {
return function () {
var t = $D.today(), shift = n - t.getDay();
if (n === 0 && $C.firstDayOfWeek === 1 && t.getDay() !== 0) {
shift = shift + 7;
}
return t.addDays(shift);
};
};
and i've changed it to:
var sdf = function (n) {
return function () {
var t = $D.today(), shift = n - t.getDay();
if (n === 0 && $C.firstDayOfWeek === 1 && t.getDay() !== 0) {
shift = shift + 7;
} else if (t.getDay() === 0 && n !== 0) {
shift = shift - 7;
}
return t.addDays(shift);
};
};
Obviously, it solves my problem.
Original comment by sullaro...@gmail.com
on 4 Mar 2013 at 8:54
This is incorrect. The day of the week shouldn't change - just when the week
starts. You're misunderstanding the purpose of that value.
Sunday will always be 0, it's just that the WEEK will start on Monday if
firstDayOfWeek is 1. That doesn't make Monday 0 indexed. Quite the opposite.
Basically this is user error/misunderstanding.
Original comment by darkcr...@gmail.com
on 19 Sep 2013 at 9:11
Original issue reported on code.google.com by
sullaro...@gmail.com
on 3 Mar 2013 at 3:25