Predictive scheduling (fair workweek)
The rule
Fair-workweek laws make an employer pay for short notice and short rest:
- Rest between shifts. An employee who works within 10 hours of the end of their last shift (a “clopening”: closing, then opening) is paid a premium for the hours worked inside those 10 hours. Some cities pay a flat amount for each instead.
- Schedule changes. A schedule is posted 14 days ahead. A change after that pays predictability pay: an hour for time added or a shift moved, and half the employee’s pay for the hours taken away.
Who uses it
Retail, hospitality and food-service employers in cities and states with fair-workweek laws, and employers that follow the practice by policy.
How the recipe does it
Configuration only: a package (package.toml) of one layer.
[[layer]]id = "fair-workweek"[[layer.step]]id = "rest"uses = "standard/short_rest"params = { at_least = "10h", to = "short_rest" }
[[layer.step]]id = "changes"uses = "standard/schedule_change_pay"params = { notice_days = 14, changed = "1h", reduced = 50 }short_restmoves the day’s hours worked withinat_leastof the end of the last work of an earlier workday (of the pay period before too) toto, a category paid at the premium (time and a half).schedule_change_paycompares a workday’s shifts as the schedule stood when its notice began (midnightnotice_daysdays before its date) with its shifts now. Time taken away paysreducedper cent of it; time added or a shift moved payschangedonce. Both go topredictability_pay, a category set up as paid and not worked.- Where the law pays a flat amount for each clopening,
short_rest_paypaysamountonce for a day started inside the rest, as money.
What your setup needs
Set up before you adopt the recipe; the recipe’s steps read them by name, and adopting it is refused, with a list of what is missing, until they exist.
- A measure called
wages: the amount the recipe adds up (money in a currency, or a count).
The scenarios show each as it was set up for them.
Parameters
| Step | Parameter | Meaning (default) |
|---|---|---|
short_rest | at_least | The rest owed between shifts ("10h"). |
to | The category the hours in the rest go to. | |
counts | The categories taken (every worked one). | |
short_rest_pay | at_least, counts | As above. |
amount, pay, category | The amount, its money measure and category. | |
schedule_change_pay | notice_days | Days of notice (14). |
changed | Pay for time added or a shift moved ("1h"). | |
reduced | Per cent of the time taken away paid (50). | |
category | Where it goes ("predictability_pay"). | |
employee_reasons | The reasons that mark an override as asked for by the employee (["employee_request"]). |
What the scenarios show
a-clopening-pays-the-hours-in-the-rest: 8 hours of rest; the next day’s first 2 hours go toshort_rest; exactly 10 hours is enough.a-clopening-across-the-start-of-a-pay-period: the rest is counted from the last shift of the period before.schedule-changes-inside-the-notice: a cut before the notice began pays nothing; a cut inside it, half the 4 hours taken away; a shift moved and hours added, an hour each.a-change-the-employee-asked-for-owes-nothing: a cut the employee asked for, recorded with the reasonemployee_request, owes nothing; a cut for staffing owes half the hours taken away.a-flat-amount-for-each-clopening: a layer pays 100.00 for the clopening in place of the premium on its hours.
Legal note
This is a common way companies implement fair-workweek premiums; check
the rules where you operate. The laws differ in the rest owed, the notice
period, the amounts, and the changes they excuse: a change the employee
asked for, a swap between employees, a change for an emergency. An
override’s reason records why the schedule changed; employee_reasons
names the reasons that owe nothing, so a swap or an emergency the law
excuses is one more reason in the list. A day owes nothing only when every
change since its notice began was excused.
Get the recipe
The recipe’s package and its scenarios are in the example packages repository: attendance/predictive_scheduling. Test it, or your own copy of it, with hourctl attend test, and publish it with hourctl attend pkg publish.
The policy package
The package’s layers, with the standard steps each one runs and their settings:
name = "predictive_scheduling"version = "1.0.0"description = "Fair-workweek premiums: the hours worked within 10 hours of the last shift's end are paid at a premium, and a schedule changed within 14 days of the day pays an hour, or half the hours taken away."
# What the tenant must have set up for the recipe: the steps read these by name.[needs]measures = ["wages"]
# Hours worked in the 10 hours after the last shift ended go to# short_rest, paid at time and a half. A day whose schedule was changed# after its notice began, 14 days before, pays predictability_pay (a# category set up as paid and not worked): an hour for time added or a# shift moved, half of the time taken away.[[layer]]id = "fair-workweek"[[layer.step]]id = "rest"uses = "standard/short_rest"params = { at_least = "10h", to = "short_rest" }
[[layer.step]]id = "changes"uses = "standard/schedule_change_pay"params = { notice_days = 14, changed = "1h", reduced = 50 }Scenarios
Each scenario gives a person’s punches and setup and the timecard they must produce, worked out with this package adopted (the format).
Scheduled Monday to Friday, 08:00 to 16:00. Wednesday was cut to 4 hours on October 1, inside its notice, at the employee's own request, recorded with the reason employee_request: nothing is owed. Thursday was cut the same day for staffing: half of the 4 hours taken away, 2 hours
description = "Scheduled Monday to Friday, 08:00 to 16:00. Wednesday was cut to 4 hours on October 1, inside its notice, at the employee's own request, recorded with the reason employee_request: nothing is owed. Thursday was cut the same day for staffing: half of the 4 hours taken away, 2 hours"
punch = [ { at = "2026-10-07 08:00", kind = "in" }, { at = "2026-10-07 12:00", kind = "out" }, { at = "2026-10-08 08:00", kind = "in" }, { at = "2026-10-08 12:00", kind = "out" },]
[policy]zone = "America/Los_Angeles"
[[category]]id = "predictability_pay"worked = false
[[shift_definition]]id = "days"start = "08:00"end = "16:00"days = ["wednesday", "thursday"]
[[schedule_override]]date = "2026-10-07"kind = "replace"start = "08:00"end = "12:00"recorded = "2026-10-01 09:00"reason = "employee_request"
[[schedule_override]]date = "2026-10-08"kind = "replace"start = "08:00"end = "12:00"recorded = "2026-10-01 09:00"reason = "staffing"
[expect]week = "2026-10-05"allocations = [ "2026-10-07 08:00-12:00 work 4.00", "2026-10-08 untimed predictability_pay 2.00", "2026-10-08 08:00-12:00 work 4.00",]Paid weekly from Monday: Sunday's close at 23:00 is the period before's, and Monday's 07:00 open the new period's first work. The rest is counted from the period before: Monday's first 2 hours go to short_rest
description = "Paid weekly from Monday: Sunday's close at 23:00 is the period before's, and Monday's 07:00 open the new period's first work. The rest is counted from the period before: Monday's first 2 hours go to short_rest"
punch = [ { at = "2026-10-11 15:00", kind = "in" }, { at = "2026-10-11 23:00", kind = "out" }, { at = "2026-10-12 07:00", kind = "in" }, { at = "2026-10-12 15:00", kind = "out" },]
[policy]zone = "America/Los_Angeles"pay_periods = { every_days = 7, from = "2026-10-05" }
[expect.period]day = "2026-10-12"allocations = [ "2026-10-12 07:00-09:00 short_rest 2.00", "2026-10-12 09:00-15:00 work 6.00",]Monday closes at 23:00 and Tuesday opens at 07:00: 8 hours of rest where 10 were owed. Tuesday's first 2 hours, to 09:00, are in the rest and go to short_rest; the rest of Tuesday is ordinary. Wednesday starts at 09:00, exactly 10 hours after Tuesday's 23:00 close: nothing
description = "Monday closes at 23:00 and Tuesday opens at 07:00: 8 hours of rest where 10 were owed. Tuesday's first 2 hours, to 09:00, are in the rest and go to short_rest; the rest of Tuesday is ordinary. Wednesday starts at 09:00, exactly 10 hours after Tuesday's 23:00 close: nothing"
punch = [ { at = "2026-10-05 14:00", kind = "in" }, { at = "2026-10-05 23:00", kind = "out" }, { at = "2026-10-06 07:00", kind = "in" }, { at = "2026-10-06 15:00", kind = "out" }, { at = "2026-10-06 18:00", kind = "in" }, { at = "2026-10-06 23:00", kind = "out" }, { at = "2026-10-07 09:00", kind = "in" }, { at = "2026-10-07 13:00", kind = "out" },]
[policy]zone = "America/Los_Angeles"
[expect]week = "2026-10-05"allocations = [ "2026-10-05 14:00-23:00 work 9.00", "2026-10-06 07:00-09:00 short_rest 2.00", "2026-10-06 09:00-15:00 work 6.00", "2026-10-06 18:00-23:00 work 5.00", "2026-10-07 09:00-13:00 work 4.00",]A city that pays a flat 100.00 for each clopening, not a premium on the hours: a layer turns the hours rule off and pays the amount once for Tuesday, which starts 8 hours after Monday's close
description = "A city that pays a flat 100.00 for each clopening, not a premium on the hours: a layer turns the hours rule off and pays the amount once for Tuesday, which starts 8 hours after Monday's close"
punch = [ { at = "2026-10-05 14:00", kind = "in" }, { at = "2026-10-05 23:00", kind = "out" }, { at = "2026-10-06 07:00", kind = "in" }, { at = "2026-10-06 15:00", kind = "out" },]
[policy]zone = "America/New_York"
[[layer]]id = "flat-amount"[[layer.step]]id = "rest"change = "disable"[[layer.step]]id = "rest-pay"uses = "standard/short_rest_pay"params = { at_least = "10h", amount = 10000, pay = "wages", category = "clopening" }
[[measure]]id = "wages"kind = "money"currency = "USD"
[expect]week = "2026-10-05"quantities = [ "2026-10-06 wages 100.00 USD clopening",]Scheduled Monday to Friday, 08:00 to 16:00. Tuesday was cut to 08:00 to 12:00 on September 1, before its notice began: nothing. Wednesday was cut the same way on October 1, inside its 14 days: half of the 4 hours taken away, 2 hours. Thursday was moved to 10:00 to 18:00 on October 2: an hour. Friday was given 2 more hours on October 5: an hour. Monday is as scheduled
description = "Scheduled Monday to Friday, 08:00 to 16:00. Tuesday was cut to 08:00 to 12:00 on September 1, before its notice began: nothing. Wednesday was cut the same way on October 1, inside its 14 days: half of the 4 hours taken away, 2 hours. Thursday was moved to 10:00 to 18:00 on October 2: an hour. Friday was given 2 more hours on October 5: an hour. Monday is as scheduled"
punch = [ { at = "2026-10-05 08:00", kind = "in" }, { at = "2026-10-05 16:00", kind = "out" }, { at = "2026-10-06 08:00", kind = "in" }, { at = "2026-10-06 12:00", kind = "out" }, { at = "2026-10-07 08:00", kind = "in" }, { at = "2026-10-07 12:00", kind = "out" }, { at = "2026-10-08 10:00", kind = "in" }, { at = "2026-10-08 18:00", kind = "out" }, { at = "2026-10-09 08:00", kind = "in" }, { at = "2026-10-09 18:00", kind = "out" },]
[policy]zone = "America/Los_Angeles"
[[category]]id = "predictability_pay"worked = false
[[shift_definition]]id = "days"start = "08:00"end = "16:00"days = ["monday", "tuesday", "wednesday", "thursday", "friday"]
[[schedule_override]]date = "2026-10-06"kind = "replace"start = "08:00"end = "12:00"recorded = "2026-09-01 09:00"
[[schedule_override]]date = "2026-10-07"kind = "replace"start = "08:00"end = "12:00"recorded = "2026-10-01 09:00"
[[schedule_override]]date = "2026-10-08"kind = "replace"start = "10:00"end = "18:00"recorded = "2026-10-02 09:00"
[[schedule_override]]date = "2026-10-09"kind = "extra"start = "16:00"end = "18:00"recorded = "2026-10-05 09:00"
[expect]week = "2026-10-05"allocations = [ "2026-10-05 08:00-16:00 work 8.00", "2026-10-06 08:00-12:00 work 4.00", "2026-10-07 untimed predictability_pay 2.00", "2026-10-07 08:00-12:00 work 4.00", "2026-10-08 untimed predictability_pay 1.00", "2026-10-08 10:00-18:00 work 8.00", "2026-10-09 untimed predictability_pay 1.00", "2026-10-09 08:00-18:00 work 10.00",]