Fix bug 372839. Gives events dragged over DST boundaries the correct time. r=jminta

git-svn-id: svn://10.0.0.236/trunk@222358 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mozilla%kewis.ch 2007-03-25 19:27:29 +00:00
parent 1092e8d243
commit ee1432a2fe
2 changed files with 34 additions and 0 deletions

View File

@ -25,6 +25,7 @@
- Stefan Sitter <ssitter@googlemail.com>
- Clint Talbert <cmtalbert@myfastmail.com>
- Michael Büttner <michael.buettner@sun.com>
- Philipp Kewisch <mozilla@kewis.ch>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
@ -638,6 +639,21 @@
var beginMove = item.startDate.clone();
beginMove.isDate = true;
var duration = boxDate.subtractDate(beginMove);
// Since both boxDate and beginMove are dates (note datetimes),
// subtractDate will only give us a non-zero number of hours on DST
// changes. While strictly speaking, subtractDate's behavior is
// correct, we need to move the event a discrete number of days here.
// There is no need for normalization here, since addDuration does
// the job for us.
if (duration.hours == 23) {
// entering DST
duration.hours++;
} else if (duration.hours == 1) {
// leaving DST
duration.hours--;
}
newStart = item.startDate.clone();
newStart.addDuration(duration);
newStart.normalize();

View File

@ -25,6 +25,7 @@
- Thomas Benisch <thomas.benisch@sun.com>
- Dan Mosedale <dan.mosedale@oracle.com>
- Michael Büttner <michael.buettner@sun.com>
- Philipp Kewisch <mozilla@kewis.ch>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
@ -1124,6 +1125,23 @@
// Figure out how much the event moved.
var duration = col.mDate.subtractDate(dragState.origDate);
var minutes = dragState.startMin - dragState.origMin;
// Since both boxDate and beginMove are dates (note datetimes),
// subtractDate will only give us a non-zero number of hours on
// DST changes. While strictly speaking, subtractDate's behavior
// is correct, we need to move the event a discrete number of
// days here. There is no need for normalization here, since
// addDuration does the job for us. Also note, the duration used
// here is only used to move over multiple days. Moving on the
// same day uses the minutes from the dragState.
if (duration.hours == 23) {
// entering DST
duration.hours++;
} else if (duration.hours == 1) {
// leaving DST
duration.hours--;
}
if (duration.isNegative) {
// Adding negative minutes to a negative duration makes the
// duration more positive, but we want more negative, and