1
0
mirror of https://github.com/dg/dibi.git synced 2025-02-24 02:43:09 +01:00

DibiResult: fixed normalization of time when begins by 00:

This commit is contained in:
Miloslav Hůla 2013-07-15 15:22:04 +02:00
parent e87c112d71
commit cf942c68ce

View File

@ -524,7 +524,7 @@ class DibiResult extends DibiObject implements IDataSource
$row[$key] = ((bool) $value) && $value !== 'f' && $value !== 'F';
} elseif ($type === dibi::DATE || $type === dibi::DATETIME) {
if ((int) $value === 0) { // '', NULL, FALSE, '0000-00-00', ...
if ((int) $value === 0 && substr((string) $value, 0, 3) !== '00:') { // '', NULL, FALSE, '0000-00-00', ...
} elseif (empty($this->formats[$type])) { // return DateTime object (default)
$row[$key] = new DibiDateTime(is_numeric($value) ? date('Y-m-d H:i:s', $value) : $value);