tweaks now that Date_Span is implemented
authorChuck Hagenbuch <chuck@horde.org>
Mon, 2 Feb 2009 19:21:27 +0000 (14:21 -0500)
committerChuck Hagenbuch <chuck@horde.org>
Mon, 2 Feb 2009 22:51:27 +0000 (17:51 -0500)
framework/Date_Parser/lib/Horde/Date/Parser/Locale/Base/Repeater/Day.php
framework/Date_Parser/lib/Horde/Date/Parser/Locale/Base/Repeater/DayPortion.php
framework/Date_Parser/lib/Horde/Date/Parser/Locale/Base/Repeater/Week.php

index db131e3..98a3bc5 100644 (file)
@@ -50,7 +50,7 @@ class Horde_Date_Parser_Locale_Base_Repeater_Day extends Horde_Date_Parser_Local
     public function offset($span, $amount, $pointer)
     {
         $direction = ($pointer == 'future') ? 1 : -1;
-        return $span->add($direction * $amount * self::DAY_SECONDS);
+        return $span->add(array('day' => $direction * $amount));
     }
 
     public function width()
index 37e351d..153db39 100644 (file)
@@ -91,11 +91,12 @@ class Horde_Date_Parser_Locale_Base_Repeater_DayPortion extends Horde_Date_Parse
         } else {
             switch ($pointer) {
             case 'future':
-                $this->currentSpan->add(array('day' => 1));
+                $this->currentSpan = $this->currentSpan->add(array('day' => 1));
                 break;
 
             case 'past':
-                $this->currentSpan->sub(array('day' => 1));
+                $this->currentSpan = $this->currentSpan->add(array('day' => -1));
+                break;
             }
         }
 
index 356c660..92f2b6c 100644 (file)
@@ -75,7 +75,7 @@ class Horde_Date_Parser_Locale_Base_Repeater_Week extends Horde_Date_Parser_Loca
     public function offset($span, $amount, $pointer)
     {
         $direction = ($pointer == 'future') ? 1 : -1;
-        return $span->add($direction * $amount * self::WEEK_SECONDS);
+        return $span->add(array('day' => $direction * $amount * 7));
     }
 
     public function width()