bug 351380 - Wrong day selected using day name in datetextpicker. r=mickey

git-svn-id: svn://10.0.0.236/trunk@221972 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mattwillis%gmail.com
2007-03-16 15:33:16 +00:00
parent 7783956638
commit 3c5c82e45e

View File

@@ -178,16 +178,17 @@
if (aWord != parser.mDayNames[i]) {
continue;
}
// Figure out what day of the week today is
var calDate = createDateTime();
calDate.jsDate = new Date();
// Figure out what day of the week today is.
var today = createDateTime();
today.jsDate = new Date();
today.getInTimezone(calendarDefaultTimezone());
// i-weekday gets the offset (off by 1), add 7 to ensure
// that the % operation stays positive.
var offset = (i-calDate.weekday+7)%7 +1;
var now = new Date();
now.setDate(now.getDate()+offset);
return now;
// i-weekday gets the offset. Add 7 to ensure that the %
// operation stays positive.
var offset = (i - today.weekday + 7) % 7;
today.day = today.day + offset;
today.normalize();
return today.jsDate;
}
return null;
}