From a876c779870299ba8e853795741059287cf648bf Mon Sep 17 00:00:00 2001 From: Robert Sworder Date: Fri, 6 Aug 2010 00:24:17 +0100 Subject: [PATCH] meridian function --- cake/libs/view/helpers/form.php | 8 ++++---- cake/tests/cases/libs/view/helpers/form.test.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php index 90538516244..6070835495e 100644 --- a/cake/libs/view/helpers/form.php +++ b/cake/libs/view/helpers/form.php @@ -1711,15 +1711,14 @@ function __dateTimeSelected($select, $fieldName, $attributes) { * that string is displayed as the empty element. * * @param string $fieldName Prefix name for the SELECT element - * @param string $selected Option which is selected. * @param string $attributes Array of Attributes * @param bool $showEmpty Show/Hide an empty option * @return string Completed meridian select input * @access public * @link http://book.cakephp.org/view/1422/meridian */ - public function meridian($fieldName, $selected = null, $attributes = array()) { - $attributes += array('empty' => true, 'value' => $selected); + public function meridian($fieldName, $attributes = array()) { + $attributes += array('empty' => true, 'value' => null); if ((empty($attributes['value']) || $attributes['value'] === true) && $value = $this->value($fieldName)) { if (is_array($value)) { extract($value); @@ -1907,9 +1906,10 @@ public function dateTime($fieldName, $dateFormat = 'DMY', $timeFormat = '12', $s case '12': $selectHourAttr['value'] = $hour; $selectMinuteAttr['value'] = $min; + $selectMeridianAttr['value'] = $meridian; $opt .= $this->hour($fieldName, false, $selectHourAttr) . ':' . $this->minute($fieldName, $selectMinuteAttr) . ' ' . - $this->meridian($fieldName, $meridian, $selectMeridianAttr); + $this->meridian($fieldName, $selectMeridianAttr); break; default: $opt .= ''; diff --git a/cake/tests/cases/libs/view/helpers/form.test.php b/cake/tests/cases/libs/view/helpers/form.test.php index f4245d95488..d6c6638bf46 100644 --- a/cake/tests/cases/libs/view/helpers/form.test.php +++ b/cake/tests/cases/libs/view/helpers/form.test.php @@ -3901,7 +3901,7 @@ function testDateTime() { date('a', $now), '/option', '*/select' - ); + ); $this->assertTags($result, $expected); $result = $this->Form->dateTime('Contact.date', 'DMY', '12');