public Week GetWeek(WeekOfTheMonth week) { if (week.ToInt() > WeekCount) { return(null); } var firstThursdayOffset = (-(int)FirstDay.DayOfTheWeek).DMod(7); var dayInWeek = FirstDay + firstThursdayOffset + (int)week * DAYS_IN_A_WEEK; return(dayInWeek.Week); }
public static string ToString(this WeekOfTheMonth weekOfTheMonth) { int numeral = weekOfTheMonth.ToInt(); return($"Week {numeral}"); }
public static int ToInt(this WeekOfTheMonth weekOfTheMonth) { return((int)weekOfTheMonth + 1); }