Bug 1273269 - Event dialog: error "gStartTime is null" when creating tasks. r=MakeMyDay a=jorgk
authorDecathlon <bv1578@gmail.com>
Tue, 17 May 2016 16:15:29 +0200
changeset 21964 3394a4eee5d937deb973f98e27e098730bee2312
parent 21963 e0db7f7c33c88ee4ed4d48851bcdf5ce31f2a346
child 21965 ef9ae4c64b4f72cced934253e11fcd27651134bd
push id1728
push usermozilla@jorgk.com
push dateThu, 19 May 2016 18:28:05 +0000
treeherdercomm-aurora@3394a4eee5d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMakeMyDay, jorgk
bugs1273269
Bug 1273269 - Event dialog: error "gStartTime is null" when creating tasks. r=MakeMyDay a=jorgk
calendar/base/content/dialogs/calendar-event-dialog.js
--- a/calendar/base/content/dialogs/calendar-event-dialog.js
+++ b/calendar/base/content/dialogs/calendar-event-dialog.js
@@ -808,17 +808,20 @@ function dateTimeControls2State(aStartDa
         } else {
             gStartTime = saveStartTime;
             gEndTime = saveEndTime;
             warning = true;
             stringWarning = cal.calGetString("calendar", "warningEndBeforeStart");
         }
     }
 
-    let startChanged = gStartTime.compare(saveStartTime) != 0;
+    let startChanged = false;
+    if (gStartTime && saveStartTime) {
+        startChanged = gStartTime.compare(saveStartTime) != 0;
+    }
     // Preset the date in the until-datepicker's minimonth to the new start
     // date if it has changed.
     if (startChanged) {
         let startDate = cal.dateTimeToJsDate(gStartTime.getInTimezone(cal.floating()));
         document.getElementById("repeat-until-datepicker").extraDate = startDate;
     }
 
     // Sort out and verify the until date if the start date has changed.
@@ -2694,19 +2697,16 @@ function updateRepeat(aSuppressDialogs, 
             if (rrules[0].length > 0) {
                 recurrenceInfo.deleteRecurrenceItem(rule);
             }
         } else {
             // New event proposes "forever" as default until date.
             recurrenceInfo = createRecurrenceInfo(item);
             setElementValue("repeat-until-datepicker", "forever");
         }
-        // Preset the until-datepicker's minimonth to the start date.
-        let startDate = cal.dateTimeToJsDate(gStartTime.getInTimezone(cal.floating()));
-        document.getElementById("repeat-until-datepicker").extraDate = startDate;
 
         repeatDeck.selectedIndex = 0;
 
         let recRule = createRecurrenceRule();
         recRule.interval = 1;
         switch (repeatValue) {
             case 'daily':
               recRule.type = 'DAILY';
@@ -2738,16 +2738,20 @@ function updateRepeat(aSuppressDialogs, 
         window.recurrenceInfo = recurrenceInfo;
 
         if (isToDo(item)) {
             if (!getElementValue("todo-has-entrydate", "checked")) {
                 setElementValue("todo-has-entrydate", "true", "checked");
             }
             disableElementWithLock("todo-has-entrydate", "repeat-lock");
         }
+
+        // Preset the until-datepicker's minimonth to the start date.
+        let startDate = cal.dateTimeToJsDate(gStartTime.getInTimezone(cal.floating()));
+        document.getElementById("repeat-until-datepicker").extraDate = startDate;
     }
 
     gLastRepeatSelection = repeatMenu.selectedIndex;
     repeatMenu.setAttribute("last-value", repeatValue);
 
     updateRepeatDetails();
     updateEntryDate();
     updateDueDate();