Bug 1151011 - Calendar events show up on wrong day when printing r/a=philipp THUNDERBIRD_38_VERBRANCH
authorDecathlon <bv1578@gmail.com>
Fri, 15 May 2015 18:50:21 +0200
branchTHUNDERBIRD_38_VERBRANCH
changeset 26042 05001d19f2006ab747be617d129ea402194e5637
parent 26036 a06908db7521d17b2fc91ea1a706570e2750c8e1
child 26043 8d40ecd6bb9f8fa971dd7caa910ccdd62ee2bb57
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1151011
Bug 1151011 - Calendar events show up on wrong day when printing r/a=philipp
calendar/import-export/calMonthGridPrinter.js
calendar/import-export/calWeekPrinter.js
--- a/calendar/import-export/calMonthGridPrinter.js
+++ b/calendar/import-export/calMonthGridPrinter.js
@@ -28,16 +28,17 @@ calMonthPrinter.prototype = {
         classDescription: "Calendar Month Grid Print Formatter",
         interfaces: calMonthPrinterInterfaces
     }),
 
     get name() cal.calGetString("calendar", "monthPrinterName"),
 
     formatToHtml: function monthPrint_format(aStream, aStart, aEnd, aCount, aItems, aTitle) {
         let document = cal.xml.parseFile("chrome://calendar-common/skin/printing/calMonthGridPrinter.html");
+        let defaultTimezone = cal.calendarDefaultTimezone();
 
         // Set page title
         document.getElementById("title").textContent = aTitle;
 
         // Table that maps YYYY-MM-DD to the DOM node container where items are to be added
         let dayTable = {};
 
         // Make sure to create tables from start to end, if passed
@@ -53,16 +54,18 @@ calMonthPrinter.prototype = {
             {
                 this.setupMonth(document, current, dayTable);
             }
         }
 
         for each (let item in aItems) {
             let itemStartDate = item[cal.calGetStartDateProp(item)] || item[cal.calGetEndDateProp(item)];
             let itemEndDate = item[cal.calGetEndDateProp(item)] || item[cal.calGetStartDateProp(item)];
+            itemStartDate = itemStartDate.getInTimezone(defaultTimezone);
+            itemEndDate = itemEndDate.getInTimezone(defaultTimezone);
 
             if (!itemStartDate && !itemEndDate) {
                 cal.print.addItemToDayboxNodate(document, item);
                 continue;
             }
 
             let boxDate = itemStartDate.clone();
             boxDate.isDate = true;
--- a/calendar/import-export/calWeekPrinter.js
+++ b/calendar/import-export/calWeekPrinter.js
@@ -28,16 +28,17 @@ calWeekPrinter.prototype = {
         classDescription: "Calendar Week Print Formatter",
         interfaces: calWeekPrinterInterfaces
     }),
 
     get name() cal.calGetString("calendar", "weekPrinterName"),
 
     formatToHtml: function weekPrint_format(aStream, aStart, aEnd, aCount, aItems, aTitle) {
         let document = cal.xml.parseFile("chrome://calendar-common/skin/printing/calWeekPrinter.html");
+        let defaultTimezone = cal.calendarDefaultTimezone();
 
         // Set page title
         document.getElementById("title").textContent = aTitle;
 
         // Table that maps YYYY-MM-DD to the DOM node container where items are to be added
         let dayTable = {};
         let weekInfoService = cal.getWeekInfoService();
 
@@ -46,16 +47,18 @@ calWeekPrinter.prototype = {
             for (let current = weekInfoService.getStartOfWeek(aStart); current.compare(aEnd) < 0; current.day += 7) {
                 this.setupWeek(document, current, dayTable);
             }
         }
 
         for each (let item in aItems) {
             let itemStartDate = item[cal.calGetStartDateProp(item)] || item[cal.calGetEndDateProp(item)];
             let itemEndDate = item[cal.calGetEndDateProp(item)] || item[cal.calGetStartDateProp(item)];
+            itemStartDate = itemStartDate.getInTimezone(defaultTimezone);
+            itemEndDate = itemEndDate.getInTimezone(defaultTimezone);
 
             if (!itemStartDate && !itemEndDate) {
                 cal.print.addItemToDayboxNodate(document, item);
                 continue;
             }
 
             let boxDate = itemStartDate.clone();
             boxDate.isDate = true;