// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Globalization; using Humanizer; namespace osu.Game.Utils { public static class HumanizerUtils { /// /// Humanizes a string using the system culture, then falls back if one cannot be found. /// /// A localization lookup failure will throw an exception of type /// /// /// The time to humanize. /// A humanized string of the given time. public static string Humanize(DateTimeOffset dateTimeOffset) { string offset; try { offset = dateTimeOffset.Humanize(); } catch (ArgumentException) { offset = dateTimeOffset.Humanize(culture: new CultureInfo("en-US")); } return offset; } } }