diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index 7af4df2d25..e5383bf3a9 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -5,6 +5,7 @@ using System; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Cursor; +using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; using osu.Game.Graphics.Sprites; using osu.Game.Utils; @@ -80,7 +81,7 @@ namespace osu.Game.Graphics public DateTimeOffset TooltipContent => Date; - private class HumanisedDate : IEquatable, ILocalisableStringData + private class HumanisedDate : ILocalisableStringData { public readonly DateTimeOffset Date; @@ -89,11 +90,18 @@ namespace osu.Game.Graphics Date = date; } - public bool Equals(HumanisedDate? other) - => other?.Date != null && Date.Equals(other.Date); - - public bool Equals(ILocalisableStringData? other) - => other is HumanisedDate otherDate && Equals(otherDate); + /// + /// Humanizer formats the relative to the local computer time. + /// Therefore, replacing a instance with another instance of the class with the same + /// should have the effect of replacing and re-formatting the text. + /// Including in equality members would stop this from happening, as + /// has equality-based early guards to prevent redundant text replaces. + /// Thus, instances of these class just compare to any to ensure re-formatting happens correctly. + /// There are "technically" more "correct" ways to do this (like also including the current time into equality checks), + /// but they are simultaneously functionally equivalent to this and overly convoluted. + /// This is a private hack-job of a wrapper around humanizer anyway. + /// + public bool Equals(ILocalisableStringData? other) => false; public string GetLocalised(LocalisationParameters parameters) => HumanizerUtils.Humanize(Date);