return Horde_Date objects instead of DateTime, and for date fields, set the
authorChuck Hagenbuch <chuck@horde.org>
Sun, 24 May 2009 19:53:11 +0000 (15:53 -0400)
committerChuck Hagenbuch <chuck@horde.org>
Sun, 24 May 2009 19:53:11 +0000 (15:53 -0400)
default format to Y-m-d

Horde_Date has a __toString() method, making it more compatible with the old
non-casting behavior, and it's also more, well, Horde-ish.

framework/Db/lib/Horde/Db/Adapter/Abstract/Column.php

index bbf60e9..4536f30 100644 (file)
@@ -211,10 +211,8 @@ class Horde_Db_Adapter_Abstract_Column
     }
 
     /**
-     * @TODO Return a Horde_Date object instead?
-     *
      * @param   string  $string
-     * @return  DateTime
+     * @return  Horde_Date
      */
     public function stringToDate($string)
     {
@@ -224,14 +222,15 @@ class Horde_Db_Adapter_Abstract_Column
             return null;
         }
 
-        return new DateTime($string);
+        $d = new Horde_Date($string);
+        $d->setDefaultFormat('Y-m-d');
+
+        return $d;
     }
 
     /**
-     * @TODO Return a Horde_Date object instead?
-     *
      * @param   string  $string
-     * @return  DateTime
+     * @return  Horde_Date
      */
     public function stringToTime($string)
     {
@@ -241,14 +240,14 @@ class Horde_Db_Adapter_Abstract_Column
             return null;
         }
 
-        return new DateTime($string);
+        return new Horde_Date($string);
     }
 
     /**
      * @TODO Return a Horde_Date object instead?
      *
      * @param   string  $string
-     * @return  DateTime
+     * @return  Horde_Date
      */
     public function stringToDummyTime($value)
     {