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