From 385bd4c7bf7457e2c38666b6bc631653437572db Mon Sep 17 00:00:00 2001 From: phlux Date: Mon, 11 Nov 2024 19:24:15 -0500 Subject: [PATCH] Change to local time to avoid UTC confusion if no date is present --- internal/clients/cbb/cbb.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/clients/cbb/cbb.go b/internal/clients/cbb/cbb.go index 66dba5f..ca5482e 100644 --- a/internal/clients/cbb/cbb.go +++ b/internal/clients/cbb/cbb.go @@ -35,7 +35,15 @@ type Team struct { func GetGameInfo(teamName, date string) string { // If no date is provided, use today's date if date == "" { - date = time.Now().Format("2006/01/02") // Format as YYYY/MM/DD + // Load Central Time location + loc, err := time.LoadLocation("America/Chicago") + if err != nil { + loc = time.FixedZone("CST", -6*60*60) // Fallback to a fixed offset if loading fails + } + + // Get current time in Central Time + currentTime := time.Now().In(loc) + date = currentTime.Format("2006/01/02") // Format as YYYY/MM/DD in Central Time } else { // Check if the last 5 characters are in MM/DD format for date input if len(date) == 5 && unicode.IsDigit(rune(date[0])) && unicode.IsDigit(rune(date[1])) && date[2] == '/' &&