Skip to content

Commit

Permalink
Fix a few small formatting flubs.
Browse files Browse the repository at this point in the history
Refs #5631
  • Loading branch information
markstory committed Jan 13, 2015
1 parent 8ce041d commit c636777
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Database/Type/DateTimeType.php
Expand Up @@ -123,15 +123,21 @@ public function marshal($value)
$format = '';
if (
isset($value['year'], $value['month'], $value['day']) &&
(is_numeric($value['year']) & is_numeric($value['month']) && is_numeric($value['day']))
(is_numeric($value['year']) && is_numeric($value['month']) && is_numeric($value['day']))
) {
$format .= sprintf('%d-%02d-%02d', $value['year'], $value['month'], $value['day']);
}

if (isset($value['meridian'])) {
$value['hour'] = strtolower($value['meridian']) === 'am' ? $value['hour'] : $value['hour'] + 12;
}
$format .= sprintf('%02d:%02d:%02d', $value['hour'], $value['minute'], $value['second']);
$format .= sprintf(
'%s%02d:%02d:%02d',
empty($format) ? '' : ' ',
$value['hour'],
$value['minute'],
$value['second']
);

return new $class($format);
}
Expand Down

0 comments on commit c636777

Please sign in to comment.