Stringify Time Zones like Horizon

This commit is contained in:
Isaac Marovitz 2024-02-28 22:18:01 -05:00
parent 87f238be60
commit a8eb25441c
No known key found for this signature in database
GPG key ID: 97250B2B09A132E1
2 changed files with 17 additions and 2 deletions

View file

@ -17,7 +17,7 @@ namespace Ryujinx.Ava.UI.Helpers
}
var timeZone = (TimeZone)value;
return string.Format("{0} {1} {2}", timeZone.UtcDifference, timeZone.Location, timeZone.Abbreviation);
return timeZone.ToString();
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)

View file

@ -1,6 +1,6 @@
namespace Ryujinx.Ava.UI.Models
{
internal class TimeZone
public class TimeZone
{
public TimeZone(string utcDifference, string location, string abbreviation)
{
@ -9,6 +9,21 @@ namespace Ryujinx.Ava.UI.Models
Abbreviation = abbreviation;
}
public string ToString()
{
// Prettifies location strings eg:
// "America/Costa_Rica" -> "Costa Rica"
var location = Location.Replace("_", " ");
if (location.Contains("/"))
{
var parts = location.Split("/");
location = parts[1];
}
return $"{UtcDifference} - {location}";
}
public string UtcDifference { get; set; }
public string Location { get; set; }
public string Abbreviation { get; set; }