// tworzenie listy z pracujacymi dniami public static List <DateTime> GetWorkedDays(DateTime start, DateTime end) { int count = (end - start).Days; List <DateTime> days = new List <DateTime>(); for (var i = 0; i < count; i++) { if (!DayOffWork.IsDayOff(start.AddDays(i))) { days.Add(start.AddDays(i)); } } return(days); }
public static DateTime GetNearestPreviousWorkDay(DateTime changeDate) { for (int i = 0; i < 14; i++) { if (DayOffWork.IsDayOff(changeDate)) { changeDate = changeDate.AddDays(-1); } else { break; } } return(changeDate); }