mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
parent
e6512c56fd
commit
c359e4b689
2 changed files with 12 additions and 0 deletions
|
@ -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('<option value="04" selected="selected">4</option>', $result);
|
||||
$this->assertContains('<option value="00" selected="selected">00</option>', $result);
|
||||
$this->assertContains('<option value="pm" selected="selected">pm</option>', $result);
|
||||
|
||||
$result = $this->Form->input('Model.start_time', array(
|
||||
'type' => 'time',
|
||||
'interval' => 15,
|
||||
|
|
|
@ -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']);
|
||||
|
|
Loading…
Reference in a new issue