Permalink
Browse files

Use more user-friendly format Y-m-d instead of Y-n-j

  • Loading branch information...
1 parent eb27880 commit 056a5ba9b5793a58ab3842bf21fb2cca158e0b6a @bakura10 bakura10 committed Aug 15, 2012
View
2 library/Zend/Form/Element/DateSelect.php
@@ -195,7 +195,7 @@ public function prepareElement(Form $form)
protected function getValidator()
{
if (null === $this->validator) {
- $this->validator = new DateValidator(array('format' => 'Y-n-j'));
+ $this->validator = new DateValidator(array('format' => 'Y-m-d'));
}
return $this->validator;
View
20 library/Zend/Form/View/Helper/FormDateSelect.php
@@ -214,12 +214,16 @@ public function getLocale()
*/
public function getDaysOptions($pattern)
{
- $formatter = new IntlDateFormatter($this->getLocale(), null, null, null, null, $pattern);
- $date = new DateTime('1970-01-01');
+ $keyFormatter = new IntlDateFormatter($this->getLocale(), null, null, null, null, 'dd');
+ $valueFormatter = new IntlDateFormatter($this->getLocale(), null, null, null, null, $pattern);
+ $date = new DateTime('1970-01-01');
$result = array();
for ($day = 1; $day <= 31; $day++) {
- $result[$day] = $formatter->format($date);
+ $key = $keyFormatter->format($date);
+ $value = $valueFormatter->format($date);
+ $result[$key] = $value;
+
$date->modify('+1 day');
}
@@ -234,12 +238,16 @@ public function getDaysOptions($pattern)
*/
public function getMonthsOptions($pattern)
{
- $formatter = new IntlDateFormatter($this->getLocale(), null, null, null, null, $pattern);
- $date = new DateTime('1970-01-01');
+ $keyFormatter = new IntlDateFormatter($this->getLocale(), null, null, null, null, 'MM');
+ $valueFormatter = new IntlDateFormatter($this->getLocale(), null, null, null, null, $pattern);
+ $date = new DateTime('1970-01-01');
$result = array();
for ($month = 1; $month <= 12; $month++) {
- $result[$month] = $formatter->format($date);
+ $key = $keyFormatter->format($date);
+ $value = $valueFormatter->format($date);
+ $result[$key] = $value;
+
$date->modify('+1 month');
}
View
2 library/Zend/Validator/Regex.php
@@ -118,7 +118,7 @@ public function isValid($value)
$this->error(self::INVALID);
return false;
}
-var_dump($value);
+
$this->setValue($value);
$status = @preg_match($this->pattern, $value);

0 comments on commit 056a5ba

Please sign in to comment.