[Canonical page](<https://docs.dhtmlx.com/planning-engine/net/api/core/data/calendar-mode/>)
[Full documentation index](<https://docs.dhtmlx.com/planning-engine/llms.txt>)


# CalendarMode

Selects which calendars place a task's work. Set it through [`SchedulingConfig.CalendarMode`](<https://docs.dhtmlx.com/planning-engine/net/api/core/data/scheduling-config.md#calendarmode>). The default is `Resource`.

## Declaration

```csharp
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`](<https://docs.dhtmlx.com/planning-engine/net/api/core/data/project-data.md#calendars>). |
| `Task` | Each task works on its own calendar only: [`TaskData.CalendarId`](<https://docs.dhtmlx.com/planning-engine/net/api/core/data/task-data.md#properties>), 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`](<https://docs.dhtmlx.com/planning-engine/net/api/core/data/scheduling-config.md>) 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](<https://docs.dhtmlx.com/planning-engine/net/scheduling/working-time-calendars.md>).

## Example

```csharp
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`](<https://docs.dhtmlx.com/planning-engine/net/api/core/data/scheduling-config.md#calendarmode>) - where the mode is set
- [`CalendarData`](<https://docs.dhtmlx.com/planning-engine/net/api/core/data/calendar-data.md>) - the calendars the mode chooses between
- [`ResourceData`](<https://docs.dhtmlx.com/planning-engine/net/api/core/data/resource-data.md>) - resource calendars
- [Working time and calendars](<https://docs.dhtmlx.com/planning-engine/net/scheduling/working-time-calendars.md>) - how each mode combines calendars
