1
0
mirror of https://github.com/ppy/osu.git synced 2024-05-14 14:40:23 +08:00

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

View File

@ -59,7 +59,8 @@ namespace osu.Game.Extensions
/// <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;