I am using the latest version Aspose.Tasks 8.5 and trying to calculate the finish date of a task given a start date and duration of 48 hours (so it should be 6 days later for 8 hour days). I have a single calendar exception on a single Saturday that I would like to be a working day. I am expecting the code below to return 7/21/2015 5:00pm, but I am getting 7/22/2015 5:00pm.
DateTime startDate = DateTime.Parse(“7/15/2015 8:00am”);
DateTime finishDate;
TimeSpan duration = new TimeSpan(8 * 6, 0, 0);Project project = new Project();
Calendar calendar = project.Calendars.Add(“Calendar1”);calendar.WeekDays.Add(WeekDay.CreateDefaultWorkingDay(DayType.Monday));
calendar.WeekDays.Add(WeekDay.CreateDefaultWorkingDay(DayType.Tuesday));
calendar.WeekDays.Add(WeekDay.CreateDefaultWorkingDay(DayType.Wednesday));
calendar.WeekDays.Add(WeekDay.CreateDefaultWorkingDay(DayType.Thursday));
calendar.WeekDays.Add(WeekDay.CreateDefaultWorkingDay(DayType.Friday));
calendar.WeekDays.Add(new WeekDay(DayType.Saturday));
calendar.WeekDays.Add(new WeekDay(DayType.Sunday));WorkingTime wt1 = new WorkingTime();
wt1.FromTime = new DateTime(1, 1, 1, 8, 0, 0, 0);
wt1.ToTime = new DateTime(1, 1, 1, 12, 0, 0, 0);
WorkingTime wt2 = new WorkingTime();
wt2.FromTime = new DateTime(1, 1, 1, 13, 0, 0, 0);
wt2.ToTime = new DateTime(1, 1, 1, 17, 0, 0, 0);CalendarException calExc = new CalendarException();
calExc.FromDate = new System.DateTime(2015, 7, 18);
calExc.ToDate = new System.DateTime(2015, 7, 18);
calExc.WorkingTimes.Add(wt1);
calExc.WorkingTimes.Add(wt2);
calExc.DayWorking = true;
calExc.EnteredByOccurrences = true;
calExc.Name = “Test”;
calExc.Occurrences = 1;
calExc.Period = 1;
calExc.Type = CalendarExceptionType.Daily;
calendar.Exceptions.Add(calExc);finishDate = calendar.GetFinishDateByStartAndWork(startDate, duration);
Console.WriteLine(finishDate);