From 1d35f4ab5a03a95b58fac3dccabd835e51d9f6e2 Mon Sep 17 00:00:00 2001 From: tanyar09 Date: Wed, 28 Jan 2026 18:15:51 +0000 Subject: [PATCH] fix: cast date filters in viewer search --- viewer-frontend/app/api/search/route.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/viewer-frontend/app/api/search/route.ts b/viewer-frontend/app/api/search/route.ts index e35cfeb..cf1382d 100644 --- a/viewer-frontend/app/api/search/route.ts +++ b/viewer-frontend/app/api/search/route.ts @@ -171,12 +171,14 @@ export async function GET(request: NextRequest) { if (dateFrom || dateTo) { if (dateFrom) { - whereConditions.push(`date_taken >= $${paramIndex}`); + // Cast param to DATE to avoid "operator does not exist: date >= text" in Postgres + whereConditions.push(`date_taken >= $${paramIndex}::date`); params.push(dateFrom); paramIndex++; } if (dateTo) { - whereConditions.push(`date_taken <= $${paramIndex}`); + // Cast param to DATE to avoid "operator does not exist: date <= text" in Postgres + whereConditions.push(`date_taken <= $${paramIndex}::date`); params.push(dateTo); paramIndex++; } -- 2.49.1