/// <summary>
        /// Long between left <see cref="DayOfWeek"/> and right <see cref="DayOfWeek"/>.
        /// </summary>
        /// <param name="left"></param>
        /// <param name="right"></param>
        /// <returns></returns>
        public static int DaysBetween(DayOfWeek left, DayOfWeek right)
        {
            var leftVal  = left.CastToInt();
            var rightVal = right.CastToInt();

            if (leftVal <= rightVal)
            {
                return(rightVal - leftVal);
            }
            return(leftVal + 7 - rightVal);
        }
Beispiel #2
0
 public static DateTime CreateByWeek(int year, int month, DayOfWeek dayOfWeek, int occurrence)
 => DateTimeCalc.OffsetByWeek(year, month, occurrence, dayOfWeek.CastToInt(0));
Beispiel #3
0
 public static bool TryOffsetByWeek(int year, int month, int weekAtMonth, DayOfWeek dayOfWeek, out DateInfo result)
 {
     return(TryOffsetByWeek(year, month, weekAtMonth, dayOfWeek.CastToInt(0), out result));
 }
Beispiel #4
0
 public static DateInfo OffsetByWeek(int year, int month, int weekAtMonth, DayOfWeek dayOfWeek)
 {
     return(OffsetByWeek(year, month, weekAtMonth, dayOfWeek.CastToInt(0)));
 }
Beispiel #5
0
 public static bool TryOffsetByWeek(int year, int month, int weekAtMonth, DayOfWeek dayOfWeek, out DateTime result)
 => TryOffsetByWeek(year, month, weekAtMonth, dayOfWeek.CastToInt(0), out result);
Beispiel #6
0
 public static DateTime OffsetByWeek(int year, int month, int weekAtMonth, DayOfWeek dayOfWeek)
 => OffsetByWeek(year, month, weekAtMonth, dayOfWeek.CastToInt(0));