Change to local time to avoid UTC confusion if no date is present
This commit is contained in:
parent
c1a20533da
commit
385bd4c7bf
@ -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] == '/' &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user