need to specify 1st day of the month for dates to be handled correcctly
authorChuck Hagenbuch <chuck@horde.org>
Fri, 22 May 2009 02:18:36 +0000 (22:18 -0400)
committerChuck Hagenbuch <chuck@horde.org>
Fri, 22 May 2009 15:57:32 +0000 (11:57 -0400)
framework/Date_Parser/lib/Horde/Date/Repeater/Month.php

index 649fab7..9afba94 100644 (file)
@@ -13,7 +13,7 @@ class Horde_Date_Repeater_Month extends Horde_Date_Repeater
         parent::next($pointer);
 
         if (!$this->currentMonthStart) {
-            $this->currentMonthStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month));
+            $this->currentMonthStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => 1));
         }
         $direction = ($pointer == 'future') ? 1 : -1;
         $this->currentMonthStart->month += $direction;
@@ -30,17 +30,17 @@ class Horde_Date_Repeater_Month extends Horde_Date_Repeater
         switch ($pointer) {
         case 'future':
             $monthStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day + 1));
-            $monthEnd = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month + 1));
+            $monthEnd = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month + 1, 'day' => 1));
             break;
 
         case 'past':
-            $monthStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month));
+            $monthStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => 1));
             $monthEnd = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day));
             break;
 
         case 'none':
-            $monthStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month));
-            $monthEnd = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month + 1));
+            $monthStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => 1));
+            $monthEnd = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month + 1, 'day' => 1));
             break;
         }