mirror of https://github.com/ppy/osu
Gracefully handle undefined `DateTimeOffset` values
Only seems to happen in tests, but best to safeguard against this regardless.
This commit is contained in:
parent
3d0caa44c8
commit
2f6e65a9a2
|
@ -58,6 +58,9 @@ 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)
|
||||
return "-";
|
||||
|
||||
var now = DateTime.Now;
|
||||
var difference = now - time;
|
||||
|
||||
|
|
Loading…
Reference in New Issue