Test Average Game Age Fix

This commit is contained in:
baz 2024-12-02 22:32:57 +00:00
parent 08a729e270
commit c4e0c9371b
1 changed files with 11 additions and 10 deletions

View File

@ -221,6 +221,7 @@ async function GetAverageGameAge() {
let month = today.getMonth() - averageGameAge.getMonth(); let month = today.getMonth() - averageGameAge.getMonth();
let day = today.getDate() - averageGameAge.getDate(); let day = today.getDate() - averageGameAge.getDate();
while (month < 0 || day < 0) {
if (month < 0) { if (month < 0) {
year--; year--;
month += 12; month += 12;
@ -231,7 +232,7 @@ async function GetAverageGameAge() {
const previousMonth = new Date(today.getFullYear(), today.getMonth(), 0); const previousMonth = new Date(today.getFullYear(), today.getMonth(), 0);
day += previousMonth.getDate(); day += previousMonth.getDate();
} }
}
return `${year} years, ${month} months, ${day} days old`; return `${year} years, ${month} months, ${day} days old`;
} }