Пример #1
0
        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);
        }
Пример #2
0
        public static string ToString(this WeekOfTheYear weekOfTheYear)
        {
            int numeral = weekOfTheYear.ToInt();

            return($"Week {numeral}");
        }
Пример #3
0
 public static int ToInt(this WeekOfTheYear weekOfTheYear)
 {
     return((int)weekOfTheYear + 1);
 }