Bug 1498152 - All-day items are displayed one day too long in summary dialog. r=philipp
authorMakeMyDay <makemyday@gmx-topmail.de>
Thu, 11 Oct 2018 16:36:00 +0200
changeset 33413 9d0f37068236caf4bed8a0773b0f70b35a58da12
parent 33412 84694c6debe3ef1ecf3f7660326244acc960e762
child 33414 952e3c43da389b749dfc7bfb84d5f6df84bbb699
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersphilipp
bugs1498152
Bug 1498152 - All-day items are displayed one day too long in summary dialog. r=philipp
calendar/base/content/calendar-item-bindings.xml
--- a/calendar/base/content/calendar-item-bindings.xml
+++ b/calendar/base/content/calendar-item-bindings.xml
@@ -29,17 +29,17 @@
                 return this.getAttribute("mode");
             } else {
                 return "start";
             }
         ]]></getter>
       </property>
       <property name="Item">
         <getter><![CDATA[
-            return mItem;
+            return this.mItem;
         ]]></getter>
         <setter><![CDATA[
             this.mItem = val;
             let headerLabel = document.getAnonymousElementByAttribute(this, "anonid", "item-datetime-label");
             let itemDateTimeLabel = document.getAnonymousElementByAttribute(this, "anonid", "item-datetime-value");
             let date;
             if (this.mode == "start") {
                 date = this.mItem[cal.dtz.startDateProp(this.mItem)];
@@ -57,16 +57,22 @@
                 if (date) {
                     let label;
                     if (cal.item.isToDo(this.mItem)) {
                         label = this.getAttribute("taskDueLabel");
                     } else {
                         label = this.getAttribute("eventEndLabel");
                     }
                     headerLabel.value = label;
+                    if (date.isDate) {
+                        // for all-day items the end/due date is not inclusive,
+                        // so we tweak this to display what the user expects
+                        date = date.clone();
+                        date.day -= 1;
+                    }
                 }
             }
             let hideLabels = (date == null);
             if (hideLabels) {
                 this.setAttribute("hidden", "true");
             } else {
                 const kDefaultTimezone = cal.dtz.defaultTimezone;
                 let localTime = date.getInTimezone(kDefaultTimezone);