From 437961d5c0ab7889783fbc366be23fae94e147b7 Mon Sep 17 00:00:00 2001 From: Brock Chelle Date: Thu, 28 Sep 2023 14:35:00 -0600 Subject: [PATCH] Improve early game logic to catch europe games too. --- src/utils/game.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/utils/game.ts b/src/utils/game.ts index d6d7424..b81069b 100644 --- a/src/utils/game.ts +++ b/src/utils/game.ts @@ -110,11 +110,18 @@ export const getLockedGames = (games: GameData[]): LockedGames => { } const isEarlyGame = (game: Date): boolean => { - // Sunday, Monday, or Tuesday games are never early - if (game.getDay() <= 2) return false - - // Wednesday, Thursday, Friday, Saturday Games should be early - return true + // Wednesday - Saturday games are always early + if (game.getDay() >= 3) return true + + // Monday, Tuesday games are never early + if (game.getDay() >= 1) return false + + // Sunday games are early if they're expected to finish before 17:00 UTC + // This is particularly important for games in Europe which typically start 3.5 hours before + // the morning waves of games in the US. + // + // The average nfl game takes 3 hours and 12 minutes, so we'll say 3 hours 20 minutes to be safe. + return game.getUTCHours() + (game.getUTCMinutes() / 60) + 3 + (20 / 60) < 17 } export const getMaxPoints = (numGames: number): number => {