allow any arg format that Horde_Date will take to simplify creating spans
authorChuck Hagenbuch <chuck@horde.org>
Sun, 24 May 2009 22:35:31 +0000 (18:35 -0400)
committerChuck Hagenbuch <chuck@horde.org>
Sun, 24 May 2009 22:35:31 +0000 (18:35 -0400)
framework/Date_Parser/lib/Horde/Date/Span.php

index 6af2c7e..ad5900c 100644 (file)
@@ -20,8 +20,17 @@ class Horde_Date_Span
      */
     public $end;
 
+    /**
+     * Constructor
+     *
+     * @param mixed $begin  Horde_Date or other format accepted by the Horde_Date constructor
+     * @param mixed $end    Horde_Date or other format accepted by the Horde_Date constructor
+     */
     public function __construct($begin, $end)
     {
+        if (! $begin instanceof Horde_Date) { $begin = new Horde_Date($begin); }
+        if (! $end instanceof Horde_Date) { $end = new Horde_Date($end); }
+
         $this->begin = $begin;
         $this->end = $end;
     }