diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php index ab17d1fad..960fc2afc 100644 --- a/cake/libs/view/helpers/form.php +++ b/cake/libs/view/helpers/form.php @@ -1316,6 +1316,8 @@ class FormHelper extends AppHelper { if (($check > 115959) && $timeFormat == '12') { $time[0] = $time[0] - 12; $meridian = 'pm'; + } elseif ($time[0] == '00' && $timeFormat == '12') { + $time[0] = 12; } elseif ($time[0] > 12) { $meridian = 'pm'; } diff --git a/cake/tests/cases/libs/view/helpers/form.test.php b/cake/tests/cases/libs/view/helpers/form.test.php index 9706cd18f..d214464bc 100644 --- a/cake/tests/cases/libs/view/helpers/form.test.php +++ b/cake/tests/cases/libs/view/helpers/form.test.php @@ -1008,6 +1008,10 @@ class FormHelperTest extends CakeTestCase { $result = $this->Form->dateTime('Contact.date', 'DMY', '12'); $this->assertPattern('/]*>/', $result); $this->assertNoPattern('/]+selected="selected"[^>]*>/', $result); + + $this->Form->data['Model']['field'] = '2008-01-01 00:00:00'; + $result = $this->Form->dateTime('Model.field', 'DMY', '12', null, array(), false); + $this->assertPattern('/option value="12" selected="selected"/', $result); } function testMonth() {