Skip to content

Commit

Permalink
treat date as datetime
Browse files Browse the repository at this point in the history
  • Loading branch information
flack committed Dec 4, 2023
1 parent 8e3077a commit 24a79de
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/api/dbobject.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function __set($field, $value)
$value = (boolean) $value;
} elseif ($mapping['type'] === 'float') {
$value = (float) $value;
} elseif ($mapping['type'] === 'datetime') {
} elseif (in_array($mapping['type'], ['datetime', 'date'])) {
if ( \is_string($value)
&& $value !== '0000-00-00 00:00:00') {
$value = new midgard_datetime($value);
Expand Down
1 change: 1 addition & 0 deletions src/storage/connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ public static function startup()
$em->getEventManager()->addEventSubscriber(new subscriber);

Type::overrideType(Types::DATETIME_MUTABLE, datetime::class);
Type::overrideType(Types::DATE_MUTABLE, datetime::class);

$midgard = midgard_connection::get_instance();
$level = self::$loglevels[$midgard->get_loglevel()];
Expand Down

0 comments on commit 24a79de

Please sign in to comment.