Catch race condition where event dates are no longer matching current view.
authorJan Schneider <jan@horde.org>
Thu, 4 Nov 2010 20:41:16 +0000 (21:41 +0100)
committerJan Schneider <jan@horde.org>
Thu, 4 Nov 2010 21:01:08 +0000 (22:01 +0100)
kronolith/js/kronolith.js

index 80b4b02..d2464d8 100644 (file)
@@ -1490,8 +1490,16 @@ KronolithCore = {
             break;
         }
 
-        var day = dates[0].clone(), date, more, title, busy, events, monthDay;
+        var day = dates[0].clone(),
+                  viewDates = this.viewDates(this.date, this.view),
+                  date, more, title, busy, events, monthDay;
         while (!day.isAfter(dates[1])) {
+            // Skip if somehow events slipped in though the view is gone.
+            if (!day.between(viewDates[0], viewDates[1])) {
+                console.log(day, this.dates);
+                continue;
+            }
+
             date = day.dateString();
             switch (view) {
             case 'day':