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 <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user