From 1fcf7d0a46c7b33eb363a6a134e9e0ba2655a318 Mon Sep 17 00:00:00 2001 From: Mike Yavorsky Date: Tue, 21 Nov 2023 20:57:20 -0500 Subject: [PATCH] agree on ISO string without trailing 'Z' character --- backend/routes/incidents.py | 4 ++-- frontend/helpers/api/api.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/routes/incidents.py b/backend/routes/incidents.py index 6f376b2b..9fcb51a7 100644 --- a/backend/routes/incidents.py +++ b/backend/routes/incidents.py @@ -90,11 +90,11 @@ def search_incidents(): if body.dateStart: query = query.filter( Incident.time_of_incident >= - datetime.strptime(body.dateStart, "%Y-%m-%d")) + datetime.fromisoformat(body.dateStart)) if body.dateEnd: query = query.filter( Incident.time_of_incident <= - datetime.strptime(body.dateEnd, "%Y-%m-%d")) + datetime.fromisoformat(body.dateEnd)) if body.description: query = query.filter( Incident.description.ilike(f"%{body.description}%") diff --git a/frontend/helpers/api/api.ts b/frontend/helpers/api/api.ts index 197402ca..7247aca0 100644 --- a/frontend/helpers/api/api.ts +++ b/frontend/helpers/api/api.ts @@ -161,8 +161,8 @@ export function searchIncidents({ dateEnd, ...rest }: IncidentSearchRequest): Promise { - if (dateStart) dateStart = new Date(dateStart).toISOString() - if (dateEnd) dateEnd = new Date(dateEnd).toISOString() + if (dateStart) dateStart = new Date(dateStart).toISOString().slice(0, -1) + if (dateEnd) dateEnd = new Date(dateEnd).toISOString().slice(0, -1) return request({ url: "/incidents/search",