From 62aebe893ecf21ad2f7e0a487a0d00963518d58c Mon Sep 17 00:00:00 2001 From: baz Date: Fri, 10 Jan 2025 15:02:20 +0000 Subject: [PATCH] Update AverageBeatInterval --- commands/100-games/wrapped.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/commands/100-games/wrapped.js b/commands/100-games/wrapped.js index 37c4b6e..5d7f288 100644 --- a/commands/100-games/wrapped.js +++ b/commands/100-games/wrapped.js @@ -144,7 +144,13 @@ async function GetNumberOfGamesBeat() { async function GetAverageBeatInterval(year) { if (userBeatenGamesDatabaseEntries && userBeatenGamesDatabaseEntries.length > 0) { - const today = new Date(year, 0, 1); + let today = new Date(); + + if (today >= Date(`${year + 1}-01-01`)) + { + today = new Date(year, 11, 31); + } + const start = new Date(year, 0, 1); const days = (today - start) / (1000 * 60 * 60 * 24); const timepergame = days / userBeatenGamesDatabaseEntries.length;