mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2026-02-10 04:13:32 +01:00
* Move extension methods closer to implementations * Fix namespaces * Make structs read-only where applicable * Use ArgumentNullException.ThrowIfNull * Use collection expressions
23 lines
589 B
C#
23 lines
589 B
C#
namespace Spectre.Console;
|
|
|
|
internal static class DayOfWeekExtensions
|
|
{
|
|
public static string GetAbbreviatedDayName(this DayOfWeek day, CultureInfo culture)
|
|
{
|
|
culture ??= CultureInfo.InvariantCulture;
|
|
return culture.DateTimeFormat
|
|
.GetAbbreviatedDayName(day)
|
|
.CapitalizeFirstLetter(culture);
|
|
}
|
|
|
|
public static DayOfWeek GetNextWeekDay(this DayOfWeek day)
|
|
{
|
|
var next = (int)day + 1;
|
|
if (next > (int)DayOfWeek.Saturday)
|
|
{
|
|
return DayOfWeek.Sunday;
|
|
}
|
|
|
|
return (DayOfWeek)next;
|
|
}
|
|
} |