Skip to main content
function minDaysOfWeekPerPeriod(
   days,
   dayOfWeek,
   opts): MinDaysOfWeekPerPeriodRuleEntry;
Enforces a minimum number of times a person works on specific days of the week within each period.

Parameters

days
number
required
Minimum number of matching days required per period.
dayOfWeek
required
readonly [DayOfWeek, DayOfWeek]Which days of the week count toward the limit.
opts
required
DaysOfWeekPerPeriodOptionsPeriod length and optional scoping.

Returns

MinDaysOfWeekPerPeriodRuleEntry
The scheduling window is divided into non-overlapping chunks of the configured period length. Within each chunk, only days matching the dayOfWeek filter are counted. The constraint ensures the count meets the minimum. When the scheduling window does not align evenly with the period boundaries, the last chunk may contain fewer matching days than the minimum. A MANDATORY priority will make the model infeasible in that case. Use a soft priority (HIGH, MEDIUM, LOW) if partial periods at the edges of the window are expected.