Add week support to viewDates().
authorJan Schneider <jan@horde.org>
Fri, 13 Mar 2009 10:57:48 +0000 (11:57 +0100)
committerJan Schneider <jan@horde.org>
Fri, 13 Mar 2009 11:26:37 +0000 (12:26 +0100)
Fix minical in non-month views.

kronolith/js/src/kronolith.js

index 62f764b..6f7319d 100644 (file)
@@ -416,7 +416,7 @@ KronolithCore = {
     updateMinical: function(date, view)
     {
         var tbody = $('kronolithMinical').down('tbody'),
-            dates = this.viewDates(date, view), day = dates[0].clone(),
+            dates = this.viewDates(date, 'month'), day = dates[0].clone(),
             weekStart, weekEnd, weekEndDay, td, tr;
 
         // Update header.
@@ -580,11 +580,16 @@ KronolithCore = {
         var start = date.clone(), end = date.clone();
 
         switch (view) {
+        case 'week':
+            start.moveToBeginOfWeek();
+            end.moveToEndOfWeek();
+            break;
         case 'month':
             start.setDate(1);
             start.moveToBeginOfWeek();
             end.moveToLastDayOfMonth();
             end.moveToEndOfWeek();
+            break;
         }
 
         return [start, end];