diff --git a/mozilla/calendar/base/content/calendar-month-view.xml b/mozilla/calendar/base/content/calendar-month-view.xml index 2c52f5538b7..79d8eb15d20 100644 --- a/mozilla/calendar/base/content/calendar-month-view.xml +++ b/mozilla/calendar/base/content/calendar-month-view.xml @@ -25,6 +25,7 @@ - Stefan Sitter - Clint Talbert - Michael Büttner + - Philipp Kewisch - - 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(); diff --git a/mozilla/calendar/base/content/calendar-multiday-view.xml b/mozilla/calendar/base/content/calendar-multiday-view.xml index 0022f956bff..796e640bed0 100644 --- a/mozilla/calendar/base/content/calendar-multiday-view.xml +++ b/mozilla/calendar/base/content/calendar-multiday-view.xml @@ -25,6 +25,7 @@ - Thomas Benisch - Dan Mosedale - Michael Büttner + - Philipp Kewisch - - 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