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++; }