diff --git a/src/Database/Helpers.php b/src/Database/Helpers.php index 852ddc875..b7ee12032 100644 --- a/src/Database/Helpers.php +++ b/src/Database/Helpers.php @@ -220,15 +220,14 @@ public static function normalizeRow(array $row, ResultSet $resultSet): array } elseif ($type === IStructure::FIELD_BOOL) { $row[$key] = ((bool) $value) && $value !== 'f' && $value !== 'F'; - } elseif ( - $type === IStructure::FIELD_DATETIME - || $type === IStructure::FIELD_DATE - || $type === IStructure::FIELD_TIME - ) { + } elseif ($type === IStructure::FIELD_DATETIME || $type === IStructure::FIELD_DATE) { $row[$key] = str_starts_with((string) $value, '0000-00') ? null : new Nette\Utils\DateTime($value); + } elseif ($type === IStructure::FIELD_TIME) { + $row[$key] = (new Nette\Utils\DateTime($value))->setDate(1, 1, 1); + } elseif ($type === IStructure::FIELD_TIME_INTERVAL) { preg_match('#^(-?)(\d+)\D(\d+)\D(\d+)(\.\d+)?$#D', $value, $m); $row[$key] = new \DateInterval("PT$m[2]H$m[3]M$m[4]S");