diff --git a/src/backend/model/database/SearchManager.ts b/src/backend/model/database/SearchManager.ts index 72163c3a..0099bf11 100644 --- a/src/backend/model/database/SearchManager.ts +++ b/src/backend/model/database/SearchManager.ts @@ -811,9 +811,14 @@ export class SearchManager { q.where( `(media.metadata.creationDate + (media.metadata.creationDateOffset * 60000)) >= :to${queryId}`, textParam - ).orWhere(`media.metadata.creationDate < :from${queryId}`, + ).orWhere(`(media.metadata.creationDate + (media.metadata.creationDateOffset * 60000)) < :from${queryId}`, textParam); } else { + q.where( + `media.metadata.creationDate >= :to${queryId}`, + textParam + ).orWhere(`media.metadata.creationDate < :from${queryId}`, + textParam); } } else { @@ -821,10 +826,14 @@ export class SearchManager { q.where( `(media.metadata.creationDate + (media.metadata.creationDateOffset * 60000)) < :to${queryId}`, textParam - ).andWhere(`media.metadata.creationDate >= :from${queryId}`, + ).andWhere(`(media.metadata.creationDate + (media.metadata.creationDateOffset * 60000)) >= :from${queryId}`, textParam); } else { - + q.where( + `media.metadata.creationDate < :to${queryId}`, + textParam + ).andWhere(`media.metadata.creationDate >= :from${queryId}`, + textParam); } } @@ -845,8 +854,6 @@ export class SearchManager { if (Config.Database.type === DatabaseType.sqlite) { - //(media.metadata.creationDate + (media.metadata.creationDateOffset * 60000)) - if (tq.daysLength == 0) { if (Config.Gallery.ignoreTimestampOffset === true) { q.where( diff --git a/test/backend/unit/model/sql/CoverManager.spec.ts b/test/backend/unit/model/sql/CoverManager.spec.ts index f7fbaa77..5898506d 100644 --- a/test/backend/unit/model/sql/CoverManager.spec.ts +++ b/test/backend/unit/model/sql/CoverManager.spec.ts @@ -128,6 +128,7 @@ describe('CoverManager', (sqlHelper: DBTestHelper) => { before(async () => { await setUpSqlDB(); + Config.Gallery.ignoreTimestampOffset = false; });