From b4f70ada495d1c166c0600a1bc6a10742e522101 Mon Sep 17 00:00:00 2001 From: Stephen Adamson Date: Mon, 22 Jun 2026 12:55:16 +0100 Subject: [PATCH] fix(today): use date string instead of time.Date for exceptional hours query Replace time.Date with formatted date string for exceptional hours query parameters to ensure correct PostgreSQL type inference. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- backend/handlers/today/today.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/backend/handlers/today/today.go b/backend/handlers/today/today.go index 88b6fdf..de94f99 100644 --- a/backend/handlers/today/today.go +++ b/backend/handlers/today/today.go @@ -413,7 +413,7 @@ func isDayOpen(r *http.Request, date time.Time) bool { } else { weekday -= 1 } - dateStart := time.Date(date.Year(), date.Month(), date.Day(), 0, 0, 0, 0, date.Location()) + dateStr := date.Format("2006-01-02") // Try exceptional hours first var exceptionalOpen sql.NullBool @@ -423,10 +423,10 @@ func isDayOpen(r *http.Request, date time.Time) bool { JOIN exceptional_working_hours_groups ewhg ON ewhg.id = ewh.group_id JOIN exceptional_group_applications ega ON ega.group_id = ewhg.id WHERE ewh.weekday = $1 - AND ega.week_start <= $2 - AND ega.week_start + INTERVAL '7 days' > $2 + AND ega.week_start <= $2::date + AND ega.week_start + INTERVAL '7 days' > $2::date LIMIT 1 - `, weekday, dateStart).Scan(&exceptionalOpen) + `, weekday, dateStr).Scan(&exceptionalOpen) if err == nil { return exceptionalOpen.Bool @@ -485,7 +485,7 @@ func getClosingTime(r *http.Request, date time.Time) string { } else { weekday -= 1 } - dateStart := time.Date(date.Year(), date.Month(), date.Day(), 0, 0, 0, 0, date.Location()) + dateStr := date.Format("2006-01-02") // Check exceptional hours first var exceptionalClose sql.NullString @@ -495,11 +495,11 @@ func getClosingTime(r *http.Request, date time.Time) string { JOIN exceptional_working_hours_groups ewhg ON ewhg.id = ewh.group_id JOIN exceptional_group_applications ega ON ega.group_id = ewhg.id WHERE ewh.weekday = $1 - AND ega.week_start <= $2 - AND ega.week_start + INTERVAL '7 days' > $2 + AND ega.week_start <= $2::date + AND ega.week_start + INTERVAL '7 days' > $2::date AND ewh.is_open = true LIMIT 1 - `, weekday, dateStart).Scan(&exceptionalClose) + `, weekday, dateStr).Scan(&exceptionalClose) if err == nil && exceptionalClose.Valid { return exceptionalClose.String