Configuring labor law compliance
Timefold’s Employee Shift Scheduling model provides a rich set of features that can be combined to express a wide variety of labor law rules about working hours, rest periods, and overtime.
This guide explains how to use these features to configure schedules that adhere to common labor law patterns, without Timefold itself prescribing or enforcing any specific jurisdiction’s legal requirements.
|
This guide is for informational purposes only. Labor laws vary by country, state, and even locality. Timefold does not provide legal advice or guarantee compliance. You are responsible for verifying that your configuration and optimization results meet applicable regulations. |
1. Common labor law patterns
Although labor laws differ by jurisdiction, most frameworks share a set of recurring concepts.
| Legal concept | Example regulation | Configuration recommendation |
|---|---|---|
Maximum daily hours |
Employees may not work more than 10 hours per day. |
Minutes worked per period with |
Maximum weekly hours |
Total working time must not exceed 48 hours per week. |
Minutes worked per period with |
Minimum daily rest |
Employees must have at least 11 hours of rest between shifts. |
Minutes between shifts constraint with |
Minimum rest per rolling-window |
Employees must have at least one full day off per 7-day period. |
Consecutive days off in a rolling window with |
Maximum consecutive work days |
Employees may not work more than 6 consecutive days. |
Maximum consecutive days worked with |
Overtime threshold |
Work beyond 40 hours/week is considered overtime. |
See Modeling overtime. |
Night work restrictions |
Night shifts may have shorter limits or require compensatory rest. |
Minutes worked per period combined with specifying |
Break requirements |
Shifts longer than 6 hours require at least a 30-minute break. |
|
Contractual limits |
Specific to part-time or fixed-term contracts. |
2. Modeling concepts
2.1. Availability and personal schedules
Each employee’s availability is defined individually. Availability data may already account for some rules. For example:
-
Don’t specify availability during (approved) PTO days
-
Restricted hours due to part-time arrangements
-
Limited availability during parental leave
-
Pre-defined working patterns or pre-arranged working times
The model will automatically respect defined availability when assigning shifts.
2.2. Per-period and rolling-window limits
We support two types of work or rest limits:
-
Per period: constraints tied to a fixed calendar period (day, week, month), e.g., “Employees may not work more than 8–12 hours per day.”
-
In a rolling window: constraints that move dynamically with time, e.g., “Employees must have at least one full day off per 7 days.”
This distinction allows the model to capture both fixed accounting rules and continuous fatigue-management requirements.
When browsing through our detailed guides around Work limits or Time off, you’ll see this concept of “per period” and “in a rolling window.”
2.3. Different employee groups and shift types
You can assign different employee contracts to:
-
Employees from different regions (e.g., “California contract”, “EU standard contract”)
-
Different job types or shift categories by targeting contracts at specific shift tags
-
Restrict total weekly hours on night shifts
-
Require minimum rest after emergency call shifts
-
Limit total hours on hazardous work shifts
-
-
Employees in specific circumstances (e.g., during parental leave or reduced-hours arrangements)
2.4. Modeling overtime
By specifying multiple contract rules with a different satisfiability level you can model overtime.
The following satisfiability options typically exist:
-
REQUIRED: A hard rule that must not be violated. -
PREFERRED: A soft rule that can be violated, but will be penalized during optimization.
For example, a person typically works 40 hours per week but can also work 8 hours of overtime:
-
Specify a Minutes worked per period rule with satisfiability
REQUIREDto 48 hours. -
Specify a Minutes worked per period rule with satisfiability
PREFERREDto 40 hours.
The model will never assign more than 48 hours and will try to keep it at or below 40, effectively attempting to avoid overtime.
2.5. Combining legal rules with company policies
Organizations often go beyond legal minimums (for example, shorter maximums for fatigue management or stronger rest requirements for safety-critical roles). You can combine rules, but also prioritise them, using Contract priorities.
2.6. How to handle long-term rules
Some labor law requirements apply over periods longer than a typical planning window. For example, if your schedule is optimized one month at a time, it is not possible for the model to directly enforce annual rules such as:
-
“At least 28 days of time off per year”
-
“Maximum 1,800 total working hours per year”
-
“Minimum 10 rest weekends per year”
These types of regulations extend beyond the scope of what the solver can evaluate within a single planning run.
However, you can still ensure compliance by tracking long-term limits externally and translating those into Timefold inputs before each planning cycle.
Here are some practical approaches used by customers:
-
Keep a cumulative record of hours worked, shifts assigned, and rest periods outside of Timefold (for example, in HR or payroll systems).
-
Adjust employee availability to reserve time for the required amount of annual leave or rest days.
-
Apply rolling-window rules for partial enforcement. While the model cannot directly check “per year” limits, you can approximate them using shorter rolling windows (e.g., “max 160 hours in any rolling 30-day window”).
-
Review and reset periodically. For example, perform a quarterly check of cumulative hours and leave usage, then update contracts or availability data accordingly.
|
The key idea is that long-term compliance often requires data feedback loops between Timefold and your HR systems. Timefold ensures compliance with the given configuration within each planning window, and your systems ensure compliance across planning windows. |
2.7. Rest breaks in shifts
While many labor laws require employees to receive a rest break (for example, 20 minutes during a 6-hour period), we generally recommend modeling this by incorporating the break into the shift duration itself, rather than splitting one shift into multiple smaller ones.
Splitting shifts to explicitly represent breaks can significantly increase solver complexity and reduce solution quality. In most real-world setups, breaks are managed locally within the assigned shift (for example, a 6-hour shift may be modeled as 6h20m of total time, accounting for the legally required break).
If breaks are unpaid or you want to distinguish between scheduled time and logged (paid) time, you can use Minutes logged per period.
This allows you to specify that a shift’s start and end times represent the full scheduled duration, while only part of that time (excluding the break) counts toward the employee’s logged or compensated minutes.
For example, a 6-hour shift including a 20-minute break would have:
-
Scheduled duration: 360 minutes
-
Logged time: 340 minutes
The logged time is then used when calculating work limits and compliance with maximum-hour constraints.
3. Regional differences
3.1. Typical European Union labor rules
EU labor law is governed by the EU Working Time Directive (2003/88/EC), which is part of a broader framework described in European labour law.
The directive defines minimum standards for rest, maximum working hours, and paid leave.
| EU directive rule | Configuration recommendation |
|---|---|
Daily rest of at least 11 hours in any 24 hours |
Consecutive minutes off in a rolling window with |
Restricts excessive night work (typically max 8 hours) |
Minutes worked per period with |
At least 24 hours rest in a 7-day period (source) |
Consecutive minutes off in a rolling window with |
No more than 48 hours of work per week, unless opt-out |
Minutes worked per period with |
Rest breaks of 20 minutes in a 6-hour period |
|
At least 28 days (4 weeks) of paid holiday per year |
3.2. Typical US labor rules
Unlike the EU, the United States does not have a single federal standard for scheduling.
The Fair Labor Standards Act (FLSA) sets general overtime thresholds, while most working-hour or rest requirements are defined at the state level (e.g., California, New York).
| Common U.S. practice | Configuration recommendation |
|---|---|
Overtime pay beyond 40 hours per week |
See Modeling overtime. |
No federal daily maximum hours |
|
Mandatory 1 day off in 7 (in some states) |
Consecutive days off in a rolling window with |
Meal break after 5 hours (CA example) |
3.2.1. Example of State Differences
In California, non-exempt employees are subject to both daily and weekly overtime triggers (e.g., overtime after 8 hours/day, double time after 12 hours/day or 8 hours on the 7th consecutive day) whereas in Texas the state follows the federal standard of overtime after 40 hours/week, with no state-mandated daily trigger (source).
This means when modelling for California you may need both daily and weekly limits; when modelling for Texas you may only need the weekly limit.
Variations in requirements can be modeled by assigning different contracts to employees per region. See employee contracts.
4. Example: multi-region configuration
In this example, two employees work for the same company, normally at different locations in two different states (State 1 and State 2). Each state has its own labor regulations:
| Concept | State 1 Contract | State 2 Contract |
|---|---|---|
Overtime and maximum hours worked (daily) |
Overtime after 8 hours per day, allowed up to 12 hours. |
Overtime after 10 hours per day, allowed up to 12 hours. |
Overtime and maximum hours worked (weekly) |
Overtime after 40 hours per week, allowed up to 50 hours. |
Overtime after 48 hours per week, allowed up to 55 hours. |
Minimum time off between shifts |
11 hours |
12 hours |
Mandatory days off per week |
Maximum 5 working days in every 7. |
Maximum 10 working days in every 14, with 2 mandatory consecutive days off in every 14. |
Maximum consecutive working days |
5 consecutive days worked. |
7 consecutive days worked. |
In emergency coverage situations, the employees can be sent to work at any locations other than their normal location, within a certain range. Therefore, both must be considered together when scheduling shifts.
However, their original labor law limits still apply regardless of where they work.
{
"modelInput": {
"contracts": [
{
"id": "State-1-contract",
"periodRules": [
{
"id": "State-1-hours-per-day",
"period": "DAY",
"minutesWorkedMax": 480,
"satisfiability": "PREFERRED"
},
{
"id": "State-1-hours-per-week",
"period": "WEEK",
"minutesWorkedMax": 2400,
"satisfiability": "PREFERRED"
},
{
"id": "State-1-max-daily-overtime",
"period": "DAY",
"minutesWorkedMax": 720,
"satisfiability": "REQUIRED"
},
{
"id": "State-1-max-weekly-overtime",
"period": "WEEK",
"minutesWorkedMax": 3000,
"satisfiability": "REQUIRED"
}
],
"minutesBetweenShiftsRules": [
{
"id": "State-1-11-hours-between-shifts",
"minimumMinutesBetweenShifts": 660,
"scope": {
"type": "duration",
"duration": "P1D"
},
"satisfiability": "REQUIRED"
}
],
"rollingWindowRules": [
{
"id": "State-1-max-5-working-days-in-every-7",
"rollingWindow": {
"type": "DAILY",
"size": 7
},
"daysWorkedLimit": {
"daysWorkedMax": 5
},
"satisfiability": "REQUIRED"
}
],
"consecutiveDaysWorkedRules": [
{
"id": "State-1-max-5-consecutive-days-worked",
"maximum": 5,
"satisfiability": "REQUIRED"
}
]
},
{
"id": "State-2-contract",
"periodRules": [
{
"id": "State-2-hours-per-day",
"period": "DAY",
"minutesWorkedMax": 600,
"satisfiability": "PREFERRED"
},
{
"id": "State-2-hours-per-week",
"period": "WEEK",
"minutesWorkedMax": 2880,
"satisfiability": "PREFERRED"
},
{
"id": "State-2-max-daily-overtime",
"period": "DAY",
"minutesWorkedMax": 720,
"satisfiability": "REQUIRED"
},
{
"id": "State-2-max-weekly-overtime",
"period": "WEEK",
"minutesWorkedMax": 3300,
"satisfiability": "REQUIRED"
}
],
"minutesBetweenShiftsRules": [
{
"id": "State-2-12-hours-between-shifts",
"minimumMinutesBetweenShifts": 720,
"scope": {
"type": "duration",
"duration": "P1D"
},
"satisfiability": "REQUIRED"
}
],
"rollingWindowRules": [
{
"id": "State-2-max-10-working-days-in-every-14",
"rollingWindow": {
"type": "DAILY",
"size": 14
},
"daysWorkedLimit":{
"daysWorkedMax": 10
},
"satisfiability": "REQUIRED"
},
{
"id": "State-2-consecutive-days-off-in-every-14",
"rollingWindow": {
"type": "DAILY",
"size": 14
},
"consecutiveDaysOffLimit":{
"consecutiveDaysOffMin": 2
},
"satisfiability": "REQUIRED"
}
],
"consecutiveDaysWorkedRules": [
{
"id": "State-2-max-7-consecutive-days-worked",
"maximum": 7,
"satisfiability": "REQUIRED"
}
]
}
],
"employees": [
{
"id": "Ann Cole",
"contracts": [
"State-1-contract"
],
"location": [
44.07,
-36.55
]
},
{
"id": "Beth Fox",
"contracts": [
"State-2-contract"
],
"location": [
44.98,
-36.96
]
}
],
"shifts": [
{
"id": "Mon M",
"start": "2025-10-13T06:00:00Z",
"end": "2025-10-13T14:00:00Z",
"location": [
44.42,
-37.71
]
},
{
"id": "Tue M",
"start": "2025-10-14T06:00:00Z",
"end": "2025-10-14T14:00:00Z",
"location": [
44.42,
-37.71
]
},
{
"id": "Wed M",
"start": "2025-10-15T06:00:00Z",
"end": "2025-10-15T14:00:00Z",
"location": [
44.42,
-37.71
]
},
{
"id": "Thurs M",
"start": "2025-10-16T06:00:00Z",
"end": "2025-10-16T14:00:00Z",
"location": [
44.42,
-37.71
]
},
{
"id": "Fri M",
"start": "2025-10-17T06:00:00Z",
"end": "2025-10-17T14:00:00Z",
"location": [
44.42,
-37.71
]
},
{
"id": "Mon N",
"start": "2025-10-13T14:00:00Z",
"end": "2025-10-13T22:00:00Z",
"location": [
44.67,
-36.91
]
},
{
"id": "Tue N",
"start": "2025-10-14T14:00:00Z",
"end": "2025-10-14T22:00:00Z",
"location": [
44.67,
-36.91
]
},
{
"id": "Wed N",
"start": "2025-10-15T14:00:00Z",
"end": "2025-10-15T22:00:00Z",
"location": [
44.67,
-36.91
]
},
{
"id": "Thurs N",
"start": "2025-10-16T14:00:00Z",
"end": "2025-10-16T22:00:00Z",
"location": [
44.67,
-36.91
]
},
{
"id": "Fri N",
"start": "2025-10-17T14:00:00Z",
"end": "2025-10-17T22:00:00Z",
"location": [
44.67,
-36.91
]
}
]
}
}
5. Limitations & best practices
-
Do not rely on defaults for compliance. Always verify your setup.
-
Test changes using small datasets before deploying across all locations.
-
Keep documentation of your configurations for audit or compliance purposes. Use our platform’s categorization features to keep track.
-
Specify additional
PREFERREDcontract rules to monitor near-violations, they’re useful indicators of schedules approaching legal or fatigue limits. -
Review regularly. Labor laws and collective agreements evolve.