Fix date failing to display on leaderboard for some scores with weird datetimes

Addresses https://github.com/ppy/osu/discussions/26517.

The score reported has a datetime of 0001/1/1 05:00:00 AM.

Bit of a dodge fix but maybe fine?
This commit is contained in:
Bartłomiej Dach 2024-01-14 13:48:47 +01:00
parent cfeab790b5
commit baf3867e17
No known key found for this signature in database
1 changed files with 2 additions and 1 deletions

View File

@ -59,7 +59,8 @@ public static LocalisableString ToFormattedDuration(this TimeSpan timeSpan)
/// <returns>A short relative string representing the input time.</returns>
public static string ToShortRelativeTime(this DateTimeOffset time, TimeSpan lowerCutoff)
{
if (time == default)
// covers all `DateTimeOffset` instances with the date portion of 0001-01-01.
if (time.Date == default)
return "-";
var now = DateTime.Now;