Пример #1
0
 /**
  * Support array(date, time) value
  *
  * @param   mixed  $value
  * @return  mixed
  */
 public function set($value)
 {
     if (is_array($value)) {
         $date = Arr::get($value, 'date');
         $time = Arr::get($value, 'time');
         $value = strtotime($date . ' ' . $time);
     }
     return parent::set($value);
 }
Пример #2
0
 /**
  * Tests that timestamps specified with a format are converted properly.
  */
 public function testIssue113()
 {
     $field = new Field_Timestamp(array('format' => 'Y-m-d H:i:s'));
     $this->assertEquals("2010-03-15 05:45:00", $field->save(NULL, "2010-03-15 05:45:00", FALSE));
     $this->assertEquals("2010-03-15 05:45:00", $field->save(NULL, 1268649900, FALSE));
 }
Пример #3
0
 /**
  * Adds a date validation rule if it doesn't already exist.
  *
  * @param   string  $model
  * @param   string  $column
  */
 public function initialize($model, $column)
 {
     parent::initialize($model, $column);
     $this->rules += array('date' => null, 'max_length' => array(10));
 }