Skip to content

Commit

Permalink
Correcting FormHelper::minute() to fix issues with extracting values …
Browse files Browse the repository at this point in the history
…from array formatted data. Fixes #107
  • Loading branch information
markstory committed Dec 19, 2009
1 parent 1e7e650 commit 3eaff3e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cake/libs/view/helpers/form.php
Expand Up @@ -1507,7 +1507,7 @@ function hour($fieldName, $format24Hours = false, $selected = null, $attributes
*/ */
function minute($fieldName, $selected = null, $attributes = array()) { function minute($fieldName, $selected = null, $attributes = array()) {
$attributes += array('empty' => true); $attributes += array('empty' => true);
$selected = $this->__dateTimeSelected('minute', $fieldName, $selected, $attributes); $selected = $this->__dateTimeSelected('min', $fieldName, $selected, $attributes);


if (strlen($selected) > 2) { if (strlen($selected) > 2) {
$selected = date('i', strtotime($selected)); $selected = date('i', strtotime($selected));
Expand Down
13 changes: 13 additions & 0 deletions cake/tests/cases/libs/view/helpers/form.test.php
Expand Up @@ -3978,6 +3978,19 @@ function testDateTime() {
$this->assertPattern('/<option[^<>]+value="03"[^<>]+selected="selected"[^>]*>3<\/option>/', $result); $this->assertPattern('/<option[^<>]+value="03"[^<>]+selected="selected"[^>]*>3<\/option>/', $result);
$this->assertPattern('/<option[^<>]+value="13"[^<>]+selected="selected"[^>]*>13<\/option>/', $result); $this->assertPattern('/<option[^<>]+value="13"[^<>]+selected="selected"[^>]*>13<\/option>/', $result);
$this->assertPattern('/<option[^<>]+value="35"[^<>]+selected="selected"[^>]*>35<\/option>/', $result); $this->assertPattern('/<option[^<>]+value="35"[^<>]+selected="selected"[^>]*>35<\/option>/', $result);

$this->assertNoErrors();
$this->Form->data['Contact'] = array(
'date' => array(
'day' => '',
'month' => '',
'year' => '',
'hour' => '',
'min' => '',
'meridian' => ''
)
);
$result = $this->Form->dateTime('Contact.date', 'DMY', '12', null, array('empty' => false));
} }


/** /**
Expand Down

0 comments on commit 3eaff3e

Please sign in to comment.