Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixing issue wher times between 12:00 and 12:59 would be incorrectly

marked as am.
Fixes #1851
  • Loading branch information...
commit 1d0e946fcf970724fa5f56a1965157019d303c05 1 parent 7fad205
@markstory markstory authored
View
2  cake/libs/view/helpers/form.php
@@ -1555,6 +1555,8 @@ function dateTime($fieldName, $dateFormat = 'DMY', $timeFormat = '12', $selected
if (($check > 115959) && $timeFormat == '12') {
$time[0] = $time[0] - 12;
$meridian = 'pm';
+ } elseif ($time[0] == '12' && $timeFormat == '12') {
+ $meridian = 'pm';
} elseif ($time[0] == '00' && $timeFormat == '12') {
$time[0] = 12;
} elseif ($time[0] > 12) {
View
7 cake/tests/cases/libs/view/helpers/form.test.php
@@ -3634,13 +3634,14 @@ function testDateTime() {
);
$this->assertTags($result, $expected);
- $selected = strtotime('2008-10-26 10:33:00');
+ $selected = strtotime('2008-10-26 12:33:00');
$result = $this->Form->dateTime('Model.field', 'DMY', '12', $selected);
$this->assertPattern('/<option[^<>]+value="2008"[^<>]+selected="selected"[^>]*>2008<\/option>/', $result);
- $this->assertPattern('/<option[^<>]+value="10"[^<>]+selected="selected"[^>]*>10<\/option>/', $result);
+ $this->assertPattern('/<option[^<>]+value="10"[^<>]+selected="selected"[^>]*>October<\/option>/', $result);
$this->assertPattern('/<option[^<>]+value="26"[^<>]+selected="selected"[^>]*>26<\/option>/', $result);
- $this->assertPattern('/<option[^<>]+value="10"[^<>]+selected="selected"[^>]*>10<\/option>/', $result);
+ $this->assertPattern('/<option[^<>]+value="12"[^<>]+selected="selected"[^>]*>12<\/option>/', $result);
$this->assertPattern('/<option[^<>]+value="33"[^<>]+selected="selected"[^>]*>33<\/option>/', $result);
+ $this->assertPattern('/<option[^<>]+value="pm"[^<>]+selected="selected"[^>]*>pm<\/option>/', $result);
$this->Form->create('Contact');
$result = $this->Form->input('published');
Please sign in to comment.
Something went wrong with that request. Please try again.