diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index 59d5e8c46..855c97c60 100644 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -2235,6 +2235,15 @@ class FormHelperTest extends CakeTestCase { * @return void */ public function testTimeSelectedWithInterval() { + $result = $this->Form->input('Model.start_time', array( + 'type' => 'time', + 'interval' => 15, + 'selected' => array('hour' => '3', 'min' => '57', 'meridian' => 'pm') + )); + $this->assertContains('', $result); + $this->assertContains('', $result); + $this->assertContains('', $result); + $result = $this->Form->input('Model.start_time', array( 'type' => 'time', 'interval' => 15, diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php index 4cf59532d..b5ce4c367 100644 --- a/lib/Cake/View/Helper/FormHelper.php +++ b/lib/Cake/View/Helper/FormHelper.php @@ -2197,6 +2197,9 @@ class FormHelper extends AppHelper { if (!empty($attributes['value'])) { if (is_array($attributes['value'])) { extract($attributes['value']); + if ($meridian === 'pm') { + $hour += 12; + } } else { if (is_numeric($attributes['value'])) { $attributes['value'] = strftime('%Y-%m-%d %H:%M:%S', $attributes['value']);