Example #1
0
        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);
        }
Example #2
0
        public static string ToString(this WeekOfTheMonth weekOfTheMonth)
        {
            int numeral = weekOfTheMonth.ToInt();

            return($"Week {numeral}");
        }
Example #3
0
 public static int ToInt(this WeekOfTheMonth weekOfTheMonth)
 {
     return((int)weekOfTheMonth + 1);
 }