mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 21:03:01 +00:00
Fix timezone handling in MLB game time display
This commit is contained in:
@@ -161,7 +161,14 @@ class BaseMLBManager:
|
||||
def _format_game_time(self, game_time: str) -> str:
|
||||
"""Format game time for display."""
|
||||
try:
|
||||
# Get timezone from config
|
||||
timezone_str = self.config.get('timezone', 'UTC')
|
||||
tz = timezone(timedelta(hours=0)) # Default to UTC if timezone not found
|
||||
|
||||
# Convert game time to local timezone
|
||||
dt = datetime.fromisoformat(game_time.replace('Z', '+00:00'))
|
||||
dt = dt.astimezone(tz)
|
||||
|
||||
return dt.strftime("%I:%M %p")
|
||||
except Exception as e:
|
||||
logger.error(f"Error formatting game time: {e}")
|
||||
@@ -205,6 +212,10 @@ class BaseMLBManager:
|
||||
game_id = event['id']
|
||||
status = event['status']['type']['name'].lower()
|
||||
|
||||
# Log the full status object for debugging
|
||||
self.logger.info(f"Game {game_id} status object: {event['status']}")
|
||||
self.logger.info(f"Game {game_id} status type: {status}")
|
||||
|
||||
# Get team information
|
||||
competitors = event['competitions'][0]['competitors']
|
||||
home_team = next(c for c in competitors if c['homeAway'] == 'home')
|
||||
|
||||
Reference in New Issue
Block a user