Esempio n. 1
0
 /**
  * {@inheritDoc}
  * @see Pi\Service\I18n
  */
 protected function normalizeDateTime($value)
 {
     if (is_numeric($value)) {
         $value = (int) $value;
     }
     if ($value && is_int($value)) {
         $result = _date($value);
     } elseif (!$value) {
         $result = '';
     } else {
         $result = $value ? parent::normalizeDateTime($value) : 0;
     }
     return $result;
 }
 public function testInvalidArgumentExceptionThrownOnInvalidInput()
 {
     $this->setExpectedException('Zend\\Filter\\Exception\\InvalidArgumentException');
     $filter = new DateTimeFormatter();
     $result = $filter->filter('2013-31-31');
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 protected function handleTypeConversions($value, $type)
 {
     switch ($type) {
         case 'date':
             $filter = new DateTimeFormatter(array('format' => 'U'));
             $value = $filter->filter($value);
             break;
         default:
             break;
     }
     if (empty($value)) {
         $value = 0;
     }
     return $value;
 }