From c0745d74d94a6b55968a8d1cdfe81ec4d256c86e Mon Sep 17 00:00:00 2001 From: Jan Henckens Date: Mon, 16 Dec 2024 20:14:32 +0100 Subject: [PATCH] postgres fix for #48 --- src/behaviors/EntryQueryBehavior.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/behaviors/EntryQueryBehavior.php b/src/behaviors/EntryQueryBehavior.php index 70221d1..7714abe 100644 --- a/src/behaviors/EntryQueryBehavior.php +++ b/src/behaviors/EntryQueryBehavior.php @@ -110,7 +110,7 @@ public function onAfterPrepare() if ($field && $this->isFuture) { $this->owner->subQuery ->andWhere(Db::parseDateParam( - '"field_' . $this->handle . $this->columnSuffix . '"::json->>\'start\'', + $field->getValueSql('start'), date('Y-m-d'), $this->includeToday ? '>=' : '>' )); @@ -119,7 +119,7 @@ public function onAfterPrepare() if ($field && $this->isPast) { $this->owner->subQuery ->andWhere(Db::parseDateParam( - '"field_' . $this->handle . $this->columnSuffix . '"::json->>\'end\'', + $field->getValueSql('end'), date('Y-m-d'), $this->includeToday ? '<=' : '<' )); @@ -128,7 +128,7 @@ public function onAfterPrepare() if ($field && $this->isNotPast) { $this->owner->subQuery ->andWhere(Db::parseDateParam( - '"field_' . $this->handle . $this->columnSuffix . '"::json->>\'end\'', + $field->getValueSql('end'), date('Y-m-d'), $this->includeToday ? '>=' : '>' )); @@ -137,13 +137,13 @@ public function onAfterPrepare() if ($field && $this->isOnGoing) { $this->owner->subQuery ->andWhere(Db::parseDateParam( - '"field_' . $this->handle . $this->columnSuffix . '"::json->>\'start\'', + $field->getValueSql('start'), date('Y-m-d'), $this->includeToday ? '<=' : '<' )); $this->owner->subQuery ->andWhere(Db::parseDateParam( - '"field_' . $this->handle . $this->columnSuffix . '"::json->>\'end\'', + $field->getValueSql('end'), date('Y-m-d'), $this->includeToday ? '>=' : '>' ));