3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Form\Element
;
12 use Zend\Validator\DateStep
as DateStepValidator
;
14 class DateTimeLocal
extends DateTime
16 const DATETIME_LOCAL_FORMAT
= 'Y-m-d\TH:i';
23 protected $attributes = array(
24 'type' => 'datetime-local',
30 protected $format = self
::DATETIME_LOCAL_FORMAT
;
33 * Retrieves a DateStepValidator configured for a Date Input type
35 * @return \Zend\Validator\ValidatorInterface
37 protected function getStepValidator()
39 $stepValue = (isset($this->attributes
['step']))
40 ?
$this->attributes
['step'] : 1; // Minutes
42 $baseValue = (isset($this->attributes
['min']))
43 ?
$this->attributes
['min'] : '1970-01-01T00:00';
45 return new DateStepValidator(array(
46 'format' => $this->format
,
47 'baseValue' => $baseValue,
48 'step' => new \
DateInterval("PT{$stepValue}M"),