Company calendar, regional holidays, summer hours
A company with two offices. London and Boston have their own public holidays, Boston works 09:00–18:00, and each person has a calendar based on their office. Pick a calendar in the tree, add “first Friday of the month off” or “July–August, Fridays until 13:00” to it, and the plan is scheduled again. Moved tasks keep a ghost of their old dates and the list says which calendar rule moved them, or which predecessor they follow.
Calendars inherit from a base
A calendar with base takes everything it does not set itself from that calendar:
each weekday it leaves null, holidays and work weeks. So a company-wide rule is written
once, an office adds only its holidays, and a person adds only their leave or part-time week. The
tree on the left shows each calendar with what it overrides. See
Working time and calendars.
// One company calendar, offices based on it, people based on their office.
const H = ["08:00-12:00", "13:00-17:00"], B = ["09:00-13:00", "14:00-18:00"];
calendars: [
{ id: "company", worktime: { days: [false, H, H, H, H, H, false] } },
{ id: "london", base: "company", worktime: {
exceptions: [{ from: "2026-08-31" }] } }, // bank holiday
{ id: "boston", base: "company", worktime: {
days: [null, B, B, B, B, B, null], // own hours; null: the company's day
exceptions: [{ from: "2026-09-07" }] } }, // Labor Day
{ id: "anna", base: "london", worktime: {
exceptions: [{ from: "2026-09-04" }] } }, // a day off
{ id: "dan", base: "boston", worktime: {
days: [false, B, B, B, B, ["09:00-13:00"], false] } },
],
resources: [{ id: "anna", calendar_id: "anna" } /* … */],
A weekday is inherited whole, hours included. Boston has its own hours, so it writes its working days itself: turn Friday off on the company calendar and London follows, Boston does not.
Recurring holidays and work weeks
The two buttons add an MS Project-style recurring exception and a work week. A work week replaces
the normal week for a date range. The demo writes only the Friday; the other days stay
null and take the default week of the calendar the work week is added to, so a work
week added to Boston keeps Boston’s hours.
// "First Friday of the month off": one recurring exception.
{
from: "2026-07-06",
to: "2026-10-04",
repeat: { every: "month", nth: 1, weekday: 5 },
}
// "July–August, Fridays until 13:00": a work week. Only Friday is written:
// a null weekday is the default week of the calendar the work week
// is added to.
customWeeks: { summer: {
from: "2026-07-01", to: "2026-09-01", // to is exclusive
days: [null, null, null, null, null, ["08:00-12:00"], null],
} }
Which layer decides a day
For a calendar and a date the first layer with a rule wins, in MS Project’s order: the calendar’s exceptions, then its bases’ exceptions; then its work weeks, then its bases’ work weeks; then its own week. Two consequences are worth trying. An office holiday beats a person’s own hours. And a work week added to the company replaces the whole week of everyone below it, Boston’s own hours included. Add it to an office to keep that office’s hours.
One calendar cannot hold two exceptions on the same date (the engine rejects it, as MS Project does). Add “first Friday off” to Anna, who is already off on Friday 4 September, and the demo says so. On her office calendar the same rule is fine: Anna’s own exception simply wins that day.
The page does not compute dates
Each change replaces one calendar record through apply. The next solve
moves the tasks the new calendar moves; the board reads the plan with getState and
the bookings with loadProfile. The month grid, the year strip and the “caused by”
labels are the engine’s as well: calendarDays returns a calendar’s working time per
date, with the calendar and the layer that decided it.
// An edit replaces one calendar record; the next solve moves what
// the calendar moves.
project.apply({
calendars: {
update: [{ id: "company", worktime: { days, exceptions, customWeeks } }],
},
});
const moved = project.solve(null).updates;
// A calendar's working time per date, with the calendar and layer that
// decided it:
project.calendarDays({
calendar: "anna",
from: "2026-08-31",
to: "2026-09-01",
});
// [{ date: "2026-08-31", ranges: [], minutes: 0,
// source: { calendar: "london", layer: "exception", key: 0 } }]
The resource calendars demo shows the simpler case: one flat calendar per person.