public override DateRangeParameter GetDateRange() { var now = TimeService.CurrentDateTime.Date; var difference = (now.DayOfWeek - beginningOfWeek.ToDayOfWeekEnum() + 7) % 7; var start = now.AddDays(-(difference + 7)); var end = start.AddDays(6); return(DateRangeParameter.WithDates(start, end)); }
private void addDaysFromPreviousMonth() { var firstDayOfMonth = CalendarMonth.DayOfWeek(1); if (firstDayOfMonth == beginningOfWeek.ToDayOfWeekEnum()) { return; } var previousMonth = CalendarMonth.Previous(); var daysInPreviousMonth = previousMonth.DaysInMonth; var daysToAdd = ((int)firstDayOfMonth - (int)beginningOfWeek.ToDayOfWeekEnum() + 7) % 7; for (int i = daysToAdd - 1; i >= 0; i--) { addDay(daysInPreviousMonth - i, previousMonth, false); } }
public override ReportsDateRangeParameter GetDateRange() { var now = TimeService.CurrentDateTime.Date; var difference = (now.DayOfWeek - beginningOfWeek.ToDayOfWeekEnum() + 7) % 7; var start = now.AddDays(-difference); var end = start.AddDays(6); return(ReportsDateRangeParameter .WithDates(start, end) .WithSource(ReportsSource.ShortcutThisWeek)); }