Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix incorrect default meridian

Prevent the default meridian from being changed from 'pm' to 'am' when the default time is in a 12-hour format between 1:00pm and 11:59pm and both a minute interval and default minute value are specified.
  • Loading branch information...
commit ec56d828b0615e10aaf22e3bd07cf6cb80a88775 1 parent 246c09a
@PhantomWatson PhantomWatson authored
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/Cake/View/Helper/FormHelper.php
View
5 lib/Cake/View/Helper/FormHelper.php
@@ -2383,11 +2383,16 @@ public function dateTime($fieldName, $dateFormat = 'DMY', $timeFormat = '12', $a
$current->setDate($year, $month, $day);
}
if ($hour !== null) {
+ if ($timeFormat == '12') {
+ $hour = date('H', strtotime("$hour:$min $meridian"));
+ }
$current->setTime($hour, $min);
}
$change = (round($min * (1 / $interval)) * $interval) - $min;
$current->modify($change > 0 ? "+$change minutes" : "$change minutes");
$newTime = explode(' ', $current->format('Y m d H i a'));
+ $format = ($timeFormat == '12') ? 'Y m d h i a' : 'Y m d H i a';
+ $newTime = explode(' ', $current->format($format));
list($year, $month, $day, $hour, $min, $meridian) = $newTime;
}
Please sign in to comment.
Something went wrong with that request. Please try again.