mirror of
https://github.com/ppy/osu
synced 2025-03-25 04:18:03 +00:00
Fix CI issues
This commit is contained in:
parent
0d83c5a39a
commit
31b7ce053d
@ -14,13 +14,12 @@ namespace osu.Game.Utils
|
||||
{
|
||||
if (quantity <= 1)
|
||||
return $@"{quantity}{template}";
|
||||
|
||||
return $@"{quantity}{template}s";
|
||||
}
|
||||
|
||||
public static string FormatDate(DateTimeOffset time, TimeSpan lowerCutoff)
|
||||
{
|
||||
// This function fails if the passed in time is something close to an epoch
|
||||
|
||||
// web uses momentjs's custom locales to format the date for the purposes of the scoreboard.
|
||||
// this is intended to be a best-effort, more legible approximation of that.
|
||||
// compare:
|
||||
@ -57,10 +56,13 @@ namespace osu.Game.Utils
|
||||
}
|
||||
|
||||
int years = 1;
|
||||
// DateTime causes a crash here for epoch
|
||||
while (time <= now.AddYears(-(years + 1)))
|
||||
// Add upper bound to prevent a crash
|
||||
while (years < 20 && time <= now.AddYears(-(years + 1)))
|
||||
years += 1;
|
||||
if (years < 20)
|
||||
return FormatQuantity("yr", years);
|
||||
|
||||
return "never";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user