Files
spectre.console/src/Spectre.Console/Extensions/Bcl/DayOfWeekExtensions.cs
Patrik Svensson 86abe0cc12 Modernize and clean up the code base a bit
* Move extension methods closer to implementations
* Fix namespaces
* Make structs read-only where applicable
* Use ArgumentNullException.ThrowIfNull
* Use collection expressions
2026-01-11 20:07:56 +01:00

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;
}
}