Skip to content

Commit

Permalink
pkp/pkp-lib#10155 Fix PostgreSQL date format error in OAI
Browse files Browse the repository at this point in the history
  • Loading branch information
asmecher committed Jul 3, 2024
1 parent 706a48b commit 3332ac5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions classes/oai/ops/OAIDAO.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,10 @@ public function _getRecordsRecordSetQuery($setIds, $from, $until, $set, $submiss
return $query->where('p.section_id', '=', $sectionId);
})
->when($from, function ($query, $from) {
return $query->where('a.last_modified', '>=', $this->datetimeToDB($from));
return $query->whereDate('a.last_modified', '>=', \DateTime::createFromFormat('U', $from));
})
->when($until, function ($query, $until) {
return $query->where('a.last-modified', '<=', $this->datetimeToDB($until));
return $query->whereDate('a.last-modified', '<=', \DateTime::createFromFormat('U', $until));
})
->when($submissionId, function ($query, $submissionId) {
return $query->where('a.submission_id', '=', $submissionId);
Expand Down Expand Up @@ -295,10 +295,10 @@ public function _getRecordsRecordSetQuery($setIds, $from, $until, $set, $submiss
->orWhere('dot.set_spec', 'like', $set . ':%');
})
->when($from, function ($query, $from) {
return $query->where('dot.date_deleted', '>=', $from);
return $query->whereDate('dot.date_deleted', '>=', \DateTime::createFromFormat('U', $from));
})
->when($until, function ($query, $until) {
return $query->where('dot.date_deleted', '<=', $until);
return $query->whereDate('dot.date_deleted', '<=', \DateTime::createFromFormat('U', $until));
})
->when($submissionId, function ($query, $submissionId) {
return $query->where('dot.data_object_id', '=', (int) $submissionId);
Expand Down

0 comments on commit 3332ac5

Please sign in to comment.