Skip to content
Permalink
Browse files

Correctly marshall 12:00 times with meridans.

Refs #7430
  • Loading branch information...
markstory committed Sep 30, 2015
1 parent 543b49b commit 47bfec70930a95b62a54ec3e496dffb7230c578f
@@ -165,6 +165,9 @@ public function marshal($value)
$format .= sprintf('%d-%02d-%02d', $value['year'], $value['month'], $value['day']);
}
if (isset($value['meridian']) && (int)$value['hour'] === 12) {
$value['hour'] = 0;
}
if (isset($value['meridian'])) {
$value['hour'] = strtolower($value['meridian']) === 'am' ? $value['hour'] : $value['hour'] + 12;
}
@@ -1202,10 +1202,10 @@ protected static function _getDateString($value)
}
if (isset($value['hour'])) {
if (isset($value['meridian']) && (int)$value['hour'] === 12) {
$value['hour'] = 0;
}
if (isset($value['meridian'])) {
if ((int)$value['hour'] === 12) {
$value['hour'] = 0;
}
$value['hour'] = strtolower($value['meridian']) === 'am' ? $value['hour'] : $value['hour'] + 12;
}
$value += ['minute' => 0, 'second' => 0];
@@ -152,6 +152,14 @@ public function marshalProvider()
],
new Time('2014-02-14 01:14:15')
],
[
[
'year' => 2014, 'month' => 2, 'day' => 14,
'hour' => 12, 'minute' => 04, 'second' => 15,
'meridian' => 'pm'
],
new Time('2014-02-14 12:04:15')
],
[
[
'year' => 2014, 'month' => 2, 'day' => 14,

0 comments on commit 47bfec7

Please sign in to comment.
You can’t perform that action at this time.