[Canonical page](<https://docs.dhtmlx.com/planning-engine/java/api/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 as [`SchedulingConfig.calendarMode`](<https://docs.dhtmlx.com/planning-engine/java/api/data/scheduling-config.md#calendarmode>). The default is `RESOURCE`.

## Declaration

```java
package org.dhtmlx.plen;

public enum CalendarMode {
  RESOURCE,
  TASK,
  TASK_INHERITED
}
```

## 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/java/api/data/project-data.md#fields>). |
| `TASK` | Each task works on its own calendar only: [`TaskData.calendarId`](<https://docs.dhtmlx.com/planning-engine/java/api/data/task-data.md#fields>), else the global calendar. Resource calendars are ignored, and a resource's `calendarId` isn't resolved. |
| `TASK_INHERITED` | Same as `TASK`, except that a task without a `calendarId` uses the calendar of its nearest ancestor that has one. |

Only `TASK_INHERITED` inherits calendars from summary tasks. With [`SchedulingConfig.useCalendars`](<https://docs.dhtmlx.com/planning-engine/java/api/data/scheduling-config.md#usecalendars>) set to `false`, every calendar is flat 24/7 time, so the mode has no effect on dates.

[Working-time calendars](<https://docs.dhtmlx.com/planning-engine/java/scheduling/working-time-calendars.md>) covers how each mode combines calendars and places work.

## Example

```java
import org.dhtmlx.plen.*;
import java.util.List;

public class InheritedCalendar {
    public static void main(String[] args) throws Exception {
        Moment start = Moment.fromYmdHm(2026, 8, 14, 8, 0);

        CalendarData sixDay = new CalendarData()
            .withId(Id.str("six-day"))
            .withWorktime(new Worktime()
                .withDays(new boolean[] {false, true, true, true, true, true, true})); // Sun..Sat

        ProjectData data = new ProjectData()
            .withConfig(new SchedulingConfig().withCalendarMode(CalendarMode.TASK_INHERITED))
            .withCalendars(List.of(sixDay))
            .withTasks(List.of(
                new TaskData(Id.str("phase"))
                    .withTaskType(TaskType.SUMMARY)
                    .withCalendarId(Id.str("six-day")),
                // No calendarId: works on "six-day", taken from "phase".
                new TaskData(Id.str("pour"))
                    .withParent(Id.str("phase"))
                    .withStartDate(start)
                    .withDuration(2.0)));

        ScheduleResult result = Engine.schedule(data, new SolveOptions().withIncludeUnchanged(true));
        for (Mutation update : result.updates) {
            System.out.println(update.id + ": " + update.startDate + " -> " + update.endDate);
        }
    }
}
```

## Related

- [`SchedulingConfig`](<https://docs.dhtmlx.com/planning-engine/java/api/data/scheduling-config.md#calendarmode>) - where the mode is set
- [`CalendarData`](<https://docs.dhtmlx.com/planning-engine/java/api/data/calendar-data.md>) - the calendars it chooses between
- [Working time and calendars](<https://docs.dhtmlx.com/planning-engine/java/scheduling/working-time-calendars.md>) - task and resource calendars
- [Resources and assignments](<https://docs.dhtmlx.com/planning-engine/java/resources-and-assignment/resources-and-assignments.md>) - how resource calendars affect assignments
