예제 #1
0
        /// <summary>
        /// Returns the list of days specified by the <see cref="DaysOfWeek"/>, relative to a given date.
        /// </summary>
        /// <param name="date">The date on which the relative days must be calculated.</param>
        /// <returns>The list of days relative to the specified <paramref name="date"/>.</returns>
        protected List <int> GetRelativeDaysOfWeekTo(DateTime date)
        {
            var baseOffset = date.DaysFromStartOfTheWeek(FirstDayOfWeek);

            var offsets = new List <int>(DateUtils.DaysPerWeek);

            foreach (var day in DaysOfWeek.AsEnumerable())
            {
                offsets.Add(day.DaysFromStartOfTheWeek(FirstDayOfWeek) - baseOffset);
            }

            offsets.Sort();
            return(offsets);
        }