Skip to content

Commit

Permalink
Improve early game logic to catch europe games too.
Browse files Browse the repository at this point in the history
  • Loading branch information
blchelle committed Sep 28, 2023
1 parent 43ef464 commit 437961d
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/utils/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down

0 comments on commit 437961d

Please sign in to comment.