Skip to main content
A shift pattern defines WHEN people can work: the time slots available for assignment. Shift patterns are templates that repeat across all scheduling days. The solver assigns team members to these patterns based on coverage requirements and constraints.

Examples

// Simple venue: one shift type, anyone can work it
const patterns: ShiftPattern[] = [{ id: "day", startTime: { hours: 9 }, endTime: { hours: 17 } }];
// Restaurant: different shifts for different roles
const patterns: ShiftPattern[] = [
  {
    id: "kitchen_morning",
    startTime: { hours: 6 },
    endTime: { hours: 14 },
    roleIds: ["chef", "prep_cook"],
  },
  {
    id: "floor_lunch",
    startTime: { hours: 11 },
    endTime: { hours: 15 },
    roleIds: ["waiter", "host"],
  },
];

Properties

daysOfWeek
DayOfWeek[]
Restricts which days of the week this shift pattern can be used.
  • If omitted: shift can be used on any day
  • If provided: shift can only be assigned on the specified days
// Saturday-only short shift
{ id: "saturday_shift", startTime: t(9), endTime: t(14), daysOfWeek: ["saturday"] }

// Weekday-only full shift
{ id: "full_shift", startTime: t(9), endTime: t(18), daysOfWeek: ["monday", "tuesday", "wednesday", "thursday", "friday"] }
endTime
TimeOfDay
required
When the shift ends (e.g., { hours: 17, minutes: 30 } for 5:30 PM)
id
string
required
Unique identifier for this shift pattern. Used in assignments and rule configurations.
locationId
string
Physical location where this shift takes place. Used for multi-location scheduling and location-based constraints.
roleIds
[string, ...string[]]
Restricts who can be assigned to this shift based on their roles.
  • If omitted: anyone can work this shift
  • If provided: only team members whose roleIds overlap with this list can be assigned
Most venues have the same shifts for everyone and don’t need this. Use it when different roles have different schedules (e.g., kitchen staff starts earlier than floor staff).
startTime
TimeOfDay
required
When the shift starts (e.g., { hours: 9, minutes: 0 } for 9:00 AM)