Skip to content

Commit

Permalink
Remove unused code and remove strict type checks.
Browse files Browse the repository at this point in the history
Remove some unused code around manipulating hours. Also allow the
timeFormat option to be specified as either a string or an int. Both
types should be accepted and treated as equivalent.
  • Loading branch information
markstory committed Mar 19, 2013
1 parent 3753238 commit 2f79996
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/Cake/View/Helper/FormHelper.php
Expand Up @@ -2383,9 +2383,6 @@ 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;
Expand Down Expand Up @@ -2511,14 +2508,14 @@ protected function _getDateTimeValue($value, $timeFormat) {
if (!empty($timeFormat)) {
$time = explode(':', $days[1]);

if ($time[0] >= '12' && $timeFormat === '12') {
if ($time[0] >= 12 && $timeFormat == 12) {
$meridian = 'pm';
} elseif ($time[0] === '00' && $timeFormat === '12') {
} elseif ($time[0] === '00' && $timeFormat == 12) {
$time[0] = 12;
} elseif ($time[0] >= 12) {
$meridian = 'pm';
}
if ($time[0] == 0 && $timeFormat === '12') {
if ($time[0] == 0 && $timeFormat == 12) {
$time[0] = 12;
}
$hour = $min = null;
Expand Down

0 comments on commit 2f79996

Please sign in to comment.