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 30230e1 commit 020f032
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions classes/oai/omp/OAIDAO.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,10 @@ public function _getRecordsRecordSetQuery($setIds, $from, $until, $set, $submiss
->where('pf.is_available', '=', 1)
->whereNotNull('pub.date_published')
->when($from, function ($query, $from) {
return $query->where('ms.last_modified', '>=', $this->datetimeToDB($from));
return $query->whereDate('ms.last_modified', '>=', \DateTime::createFromFormat('U', $from));
})
->when($until, function ($query, $until) {
return $query->where('ms.last_modified', '<=', $this->datetimeToDB($until));
return $query->whereDate('ms.last_modified', '<=', \DateTime::createFromFormat('U', $until));
})
->when($submissionId, function ($query, $submissionId) {
return $query->where('pf.publication_format_id', '=', $submissionId);
Expand Down Expand Up @@ -285,10 +285,10 @@ public function _getRecordsRecordSetQuery($setIds, $from, $until, $set, $submiss
return $query->where('dot.set_spec', '=', $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 020f032

Please sign in to comment.