mirror of
https://github.com/dg/dibi.git
synced 2025-02-22 01:48:05 +01:00
Date 0000-01-01 is valid [Closes #402]
This commit is contained in:
parent
1881fea0e5
commit
2ac618ffff
@ -489,7 +489,7 @@ class Result implements IDataSource
|
||||
$row[$key] = ((bool) $value) && $value !== 'f' && $value !== 'F';
|
||||
|
||||
} elseif ($type === Type::DATETIME || $type === Type::DATE || $type === Type::TIME) {
|
||||
if ($value && substr((string) $value, 0, 3) !== '000') { // '', null, false, '0000-00-00', ...
|
||||
if ($value && substr((string) $value, 0, 7) !== '0000-00') { // '', null, false, '0000-00-00', ...
|
||||
$value = new DateTime($value);
|
||||
$row[$key] = $format ? $value->format($format) : $value;
|
||||
} else {
|
||||
|
@ -37,7 +37,7 @@ class Row implements \ArrayAccess, \IteratorAggregate, \Countable
|
||||
{
|
||||
$time = $this[$key];
|
||||
if (!$time instanceof DateTime) {
|
||||
if (!$time || substr((string) $time, 0, 3) === '000') { // '', null, false, '0000-00-00', ...
|
||||
if (!$time || substr((string) $time, 0, 7) === '0000-00') { // '', null, false, '0000-00-00', ...
|
||||
return null;
|
||||
}
|
||||
$time = new DateTime($time);
|
||||
|
Loading…
x
Reference in New Issue
Block a user