CalendarMode#
Selects which calendars place a task's work. Set it through SchedulingConfig.CalendarMode. The default is Resource.
Declaration#
namespace Plen;
public enum CalendarMode
{
Resource,
Task,
TaskInherited,
}
Variants#
| Variant | Description |
|---|---|
Resource |
Default. Each assignment works on its resource's calendar, intersected with the task's calendar when both have one. A resource's CalendarId must name a calendar in ProjectData.Calendars. |
Task |
Each task works on its own calendar only: TaskData.CalendarId, else the global calendar. Resource calendars are ignored, and a resource's CalendarId isn't resolved. |
TaskInherited |
Same as Task, except that a task without a CalendarId uses the calendar of its nearest ancestor that has one. |
Only TaskInherited inherits calendars from summary tasks. With SchedulingConfig.UseCalendars set to false, every calendar is flat 24/7 time, so the mode has no effect on dates.
How each mode combines calendars and places work is covered in Working time and calendars.
Example#
using Plen;
var start = Moment.FromYmdHm(2026, 8, 14, 8, 0)
?? throw new InvalidOperationException("invalid date");
var data = new ProjectData
{
Config = new SchedulingConfig { CalendarMode = CalendarMode.TaskInherited },
Calendars =
[
new CalendarData
{
Id = "six-day",
Worktime = new Worktime { Days = [false, true, true, true, true, true, true] },
},
],
Tasks =
[
new TaskData("phase") { TaskType = TaskType.Summary, CalendarId = "six-day" },
// No CalendarId: works on "six-day", taken from "phase".
new TaskData("pour") { Parent = "phase", StartDate = start, Duration = 2 },
],
};
var result = Engine.Schedule(data, new SolveOptions());
Related#
SchedulingConfig- where the mode is setCalendarData- the calendars the mode chooses betweenResourceData- resource calendars- Working time and calendars - how each mode combines calendars