Fix datetime comparison in MLBUpcomingManager by making both datetimes timezone-aware

This commit is contained in:
ChuckBuilds
2025-04-24 15:51:39 -05:00
parent 1bee555830
commit d89c952b0a

View File

@@ -3,7 +3,7 @@ import logging
import requests import requests
import json import json
from typing import Dict, Any, List, Optional from typing import Dict, Any, List, Optional
from datetime import datetime, timedelta from datetime import datetime, timedelta, timezone
import os import os
from PIL import Image, ImageDraw, ImageFont from PIL import Image, ImageDraw, ImageFont
import numpy as np import numpy as np
@@ -552,7 +552,7 @@ class MLBUpcomingManager(BaseMLBManager):
if games: if games:
# Process games # Process games
new_upcoming_games = [] new_upcoming_games = []
now = datetime.now() now = datetime.now(timezone.utc) # Make timezone-aware
upcoming_cutoff = now + timedelta(hours=24) upcoming_cutoff = now + timedelta(hours=24)
logger.info(f"Looking for games between {now} and {upcoming_cutoff}") logger.info(f"Looking for games between {now} and {upcoming_cutoff}")