mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Correcting database input value for midnight on 12-hour display, fixes #3927
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6399 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
943eaf7549
commit
7e3a30fd85
2 changed files with 6 additions and 0 deletions
|
@ -1316,6 +1316,8 @@ class FormHelper extends AppHelper {
|
||||||
if (($check > 115959) && $timeFormat == '12') {
|
if (($check > 115959) && $timeFormat == '12') {
|
||||||
$time[0] = $time[0] - 12;
|
$time[0] = $time[0] - 12;
|
||||||
$meridian = 'pm';
|
$meridian = 'pm';
|
||||||
|
} elseif ($time[0] == '00' && $timeFormat == '12') {
|
||||||
|
$time[0] = 12;
|
||||||
} elseif ($time[0] > 12) {
|
} elseif ($time[0] > 12) {
|
||||||
$meridian = 'pm';
|
$meridian = 'pm';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1008,6 +1008,10 @@ class FormHelperTest extends CakeTestCase {
|
||||||
$result = $this->Form->dateTime('Contact.date', 'DMY', '12');
|
$result = $this->Form->dateTime('Contact.date', 'DMY', '12');
|
||||||
$this->assertPattern('/<option\s+value=""[^>]*>/', $result);
|
$this->assertPattern('/<option\s+value=""[^>]*>/', $result);
|
||||||
$this->assertNoPattern('/<option[^<>]+selected="selected"[^>]*>/', $result);
|
$this->assertNoPattern('/<option[^<>]+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() {
|
function testMonth() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue