29 public static Func<DateTime, DateTime>
OneMonth => dt => dt.AddMonths(1);
34 public static Func<DateTime, DateTime>
OneQuarter => dt => dt.AddMonths(3);
39 public static Func<DateTime, DateTime>
OneYear => dt => dt.AddYears(1);
44 public static Func<DateTime, DateTime>
EndOfDay => dt => dt.AddDays(1).Date;
49 public static Func<DateTime, DateTime>
EndOfWeek
55 var value = 8 - (int)dt.DayOfWeek;
56 if (value == 8) value = 1;
57 return dt.AddDays(value).Date;
65 public static Func<DateTime, DateTime>
EndOfMonth
72 return new DateTime(value.Year, value.Month, 1);
86 var nthQuarter = (dt.Month - 1) / 3;
87 var firstMonthOfQuarter = nthQuarter * 3 + 1;
88 return OneQuarter(
new DateTime(dt.Year, firstMonthOfQuarter, 1));
96 public static Func<DateTime, DateTime>
EndOfYear => dt =>
new DateTime(dt.Year + 1, 1, 1);