Apply the format fix to the tooltip text across the board

This commit is contained in:
HoutarouOreki
2018-05-25 13:05:41 +02:00
parent 6d222a36b2
commit 961702aadf
2 changed files with 4 additions and 10 deletions

View File

@ -14,20 +14,16 @@ namespace osu.Game.Graphics
{ {
private readonly DateTimeOffset date; private readonly DateTimeOffset date;
private readonly string dateFormat; private readonly string dateFormat;
private readonly string tooltipFormat;
/// <param name="dateFormat">The string to format the date text with. /// <param name="dateFormat">The string to format the date text with.
/// May be null if the humanized format should be used.</param> /// May be null if the humanized format should be used.</param>
/// <param name="tooltipFormat">The string to format the tooltip text with. public DrawableDate(DateTimeOffset date, string dateFormat = null)
/// May be null if the default format should be used.</param>
public DrawableDate(DateTimeOffset date, string dateFormat = null, string tooltipFormat = null)
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
Font = "Exo2.0-RegularItalic"; Font = "Exo2.0-RegularItalic";
this.date = date.ToLocalTime(); this.date = date.ToLocalTime();
this.dateFormat = dateFormat; this.dateFormat = dateFormat;
this.tooltipFormat = tooltipFormat;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -70,8 +66,6 @@ namespace osu.Game.Graphics
date.Humanize() : date.Humanize() :
string.Format(dateFormat, date); string.Format(dateFormat, date);
public string TooltipText => string.IsNullOrEmpty(tooltipFormat) ? public string TooltipText => string.Format("{0:d MMMM yyyy H:mm \"UTC\"z}", date);
date.ToString() :
string.Format(tooltipFormat, date);
} }
} }

View File

@ -364,12 +364,12 @@ namespace osu.Game.Overlays.Profile
else else
{ {
infoTextLeft.AddText("Joined ", lightText); infoTextLeft.AddText("Joined ", lightText);
infoTextLeft.AddText(new DrawableDate(user.JoinDate, "{0:MMMM yyyy}", "{0:d MMMM yyyy}"), boldItalic); infoTextLeft.AddText(new DrawableDate(user.JoinDate, "{0:MMMM yyyy}"), boldItalic);
} }
infoTextLeft.NewLine(); infoTextLeft.NewLine();
infoTextLeft.AddText("Last seen ", lightText); infoTextLeft.AddText("Last seen ", lightText);
infoTextLeft.AddText(new DrawableDate(user.LastVisit, null, "{0:d MMMM yyyy H:mm \"UTC\"z}"), boldItalic); infoTextLeft.AddText(new DrawableDate(user.LastVisit, null), boldItalic);
infoTextLeft.NewParagraph(); infoTextLeft.NewParagraph();
if (user.PlayStyle?.Length > 0) if (user.PlayStyle?.Length > 0)