Hi everyone,
I am trying to create a custom calendar that has working hours of 08:00 to 17:00 without the usual 1 hour break. The code is pretty vanilla -
Project project = new Project();
Calendar cal = project.Calendars.Add("MyTest");
WorkingTime wt1 = new WorkingTime(new DateTime(10, 1, 1, 8, 0, 0,0), new DateTime(10, 1, 1, 17, 0, 0));
cal.WeekDays[0].FromDate = new DateTime(1, 1, 1, 0, 0, 0);
cal.WeekDays[0].ToDate = new DateTime(1, 1, 1, 0, 0,0);
var workingtimes = cal.WeekDays[0].WorkingTimes[1];
cal.WeekDays[0].WorkingTimes.Remove(workingtimes);
cal.WeekDays[0].WorkingTimes[0] = wt1 ;
cal.WeekDays[0].DayWorking = true;
And I can see that the object is created correctly (only working on Monday and it shows 08:00 to 17:00)
image.png (22.8 KB)
but in MS Project it shows the usual work hours-
image.png (33.5 KB)
Any ideas?
@o.werker,
Looks like the issue was fixed in v. 23.2.
I can reproduce the issue using Aspose.Tasks for .NET 23.1, but cannot reproduce it on v. 23.3.
Could you check it?
Hi Vasiliy,
I am on 23.2 and can’t see 23.3
image.png (9.8 KB)
Oren
Hi Vasiliy,
I’m seeing another odd behaviour around calendars where the duration in the code shows 1 day
image.png (5.4 KB)
but the project shows 0.81days
image.png (3.7 KB)
You’ll see that the finish is set to 03:30 PM for whatever reason and if manually adjust the duration to 1day the finish goes to 5:00PM as expected.
I even tried to force manualDuration but it does not seem to have any effect.
What’s going on?
@o.werker,
I’m sorry for the confusion caused.
The 23.3 release is in progress and the binaries haven’t been published yet. It will be available in 1-2 days.
@o.werker ,
It’s hard to say what is the reason using the screenshots.
Could you attach a template file and used code snippet please ?
Hi Vasiliy,
Confirming this seems to be working ok with 23.3.
Thanks!
1 Like
Thanks Vasiliy,
I cannot reproduce this with a vanilla build so it must be something with my current code. I’ll keep trying to understand.