Skip to content

Commit

Permalink
Merge pull request #307 from mikeyavorsky/fix-date-search
Browse files Browse the repository at this point in the history
Fix Incident date search
  • Loading branch information
mikeyavorsky authored Nov 22, 2023
2 parents d7b3310 + 1fcf7d0 commit 7a96faa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions backend/routes/incidents.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,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}%")
Expand Down
4 changes: 2 additions & 2 deletions frontend/helpers/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ export function searchIncidents({
dateEnd,
...rest
}: IncidentSearchRequest): Promise<IncidentSearchResponse> {
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",
Expand Down

0 comments on commit 7a96faa

Please sign in to comment.