Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Form / Element / Date.php
blob3bb1a3a1734a587825ae722f26121ad84ff01d87
1 <?php
2 /**
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
8 */
10 namespace Zend\Form\Element;
12 use DateInterval;
13 use Zend\Form\Element;
14 use Zend\Form\Element\DateTime as DateTimeElement;
15 use Zend\Validator\Date as DateValidator;
16 use Zend\Validator\DateStep as DateStepValidator;
18 class Date extends DateTimeElement
20 /**
21 * Seed attributes
23 * @var array
25 protected $attributes = array(
26 'type' => 'date',
29 /**
30 * Date format to use for DateTime values. By default, this is RFC-3339,
31 * full-date (Y-m-d), which is what HTML5 dictates.
33 * @var string
35 protected $format = 'Y-m-d';
37 /**
38 * Retrieves a DateStep Validator configured for a Date Input type
40 * @return \Zend\Validator\ValidatorInterface
42 protected function getStepValidator()
44 $format = $this->getFormat();
45 $stepValue = (isset($this->attributes['step']))
46 ? $this->attributes['step'] : 1; // Days
48 $baseValue = (isset($this->attributes['min']))
49 ? $this->attributes['min'] : date($format, 0);
51 return new DateStepValidator(array(
52 'format' => $format,
53 'baseValue' => $baseValue,
54 'step' => new DateInterval("P{$stepValue}D"),
55 ));