diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php index 90e8f0436..5983c1abf 100644 --- a/cake/libs/view/helpers/form.php +++ b/cake/libs/view/helpers/form.php @@ -1467,7 +1467,7 @@ class FormHelper extends AppHelper { if (is_array($selected)) { extract($selected); } else { - if (is_int($selected)) { + if (is_numeric($selected)) { $selected = strftime('%Y-%m-%d %H:%M:%S', $selected); } $meridian = 'am'; diff --git a/cake/tests/cases/libs/view/helpers/form.test.php b/cake/tests/cases/libs/view/helpers/form.test.php index cdf8e0942..68a4e790b 100644 --- a/cake/tests/cases/libs/view/helpers/form.test.php +++ b/cake/tests/cases/libs/view/helpers/form.test.php @@ -3165,6 +3165,14 @@ class FormHelperTest extends CakeTestCase { '*/select' ); $this->assertTags($result, $expected); + + $selected = '1225031586'; + $result = $this->Form->dateTime('Model.field', 'DMY', '12', $selected); + $this->assertPattern('/]+value="2008"[^<>]+selected="selected"[^>]*>2008<\/option>/', $result); + $this->assertPattern('/]+value="10"[^<>]+selected="selected"[^>]*>10<\/option>/', $result); + $this->assertPattern('/]+value="26"[^<>]+selected="selected"[^>]*>26<\/option>/', $result); + $this->assertPattern('/]+value="10"[^<>]+selected="selected"[^>]*>10<\/option>/', $result); + $this->assertPattern('/]+value="33"[^<>]+selected="selected"[^>]*>33<\/option>/', $result); $this->Form->create('Contact'); $result = $this->Form->input('published');