Weekly overtime over 40 hours
The rule
Every hour worked past 40 in a workweek is overtime. The workweek is a fixed run of seven days (here Monday to Sunday); hours are counted in the week they are worked, whatever the pay period.
Who uses it
Almost every employer of hourly staff in the United States: it is the federal overtime rule, and the base most state rules add to. Employers elsewhere use the same shape with another number (a 38- or 44-hour week).
How the recipe does it
Configuration only: a package (package.toml) of one layer, with the
standard attribute and threshold steps.
[[layer]]id = "overtime"settings = { week_starts = "monday" } # the workweek; Monday is the default[[layer.step]]id = "split"uses = "standard/attribute"params = { mode = "split" }[[layer.step]]id = "weekly"uses = "standard/threshold"params = { over = "40h", to = "overtime", window = "week" }threshold adds up the worked time of the window (here each week) and moves
what is over 40 hours to overtime, the latest time first, splitting a line
at the exact instant. A week that starts before the pay period counts the
earlier period’s lines without moving them, so a week split by a pay date
is still one workweek.
An overnight shift belongs whole to the workday it starts in unless the
policy says otherwise. For a workweek, hours count where they are worked:
standard/attribute with mode = "split" cuts a shift from Sunday night
into Monday at midnight, each piece in its own day and week.
Parameters
| Parameter | Meaning |
|---|---|
over | The hours a week may have before overtime: "40h". |
to | The category overtime goes to. |
window | "week": each workweek of the policy (week_starts). |
counts | The categories counted (default: every worked one). Paid leave and holidays are set up as not worked, so they do not count. |
What the scenarios show
exactly-forty-is-not-overtime: five eight-hour days, no overtime.one-minute-over: 40 hours and a minute is a minute of overtime, the week’s last; its decimal hours are carried, never rounded up.an-overnight-shift-across-the-week-boundary: split at midnight, Sunday’s two hours are overtime in the first week and Monday’s six start the next.a-week-across-two-pay-periods: a company paid on the 1st and 16th (its own layer setspay_periods), Friday the 16th is overtime because Monday to Thursday, in the earlier period, are counted.
Legal note
This is a common way companies implement weekly overtime; check the rules where you operate (who is exempt, the workweek you have declared, and any state or contract rule that pays more).
Get the recipe
The recipe’s package and its scenarios are in the example packages repository: attendance/weekly_overtime. 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 = "weekly_overtime"version = "1.0.0"description = "Time worked past 40 hours in a workweek is overtime, counted in the week it was worked, across pay periods."
# The workweek runs Monday to Sunday. An overnight shift is cut at midnight, so hours count in the# workweek they are worked in; time past 40 hours a week is overtime.[[layer]]id = "overtime"settings = { week_starts = "monday" }[[layer.step]]id = "split"uses = "standard/attribute"params = { mode = "split" }[[layer.step]]id = "weekly"uses = "standard/threshold"params = { over = "40h", to = "overtime", window = "week" }Scenarios
Each scenario gives a person’s punches and setup and the timecard they must produce, worked out with this package adopted (the format).
Paid on the 1st and 16th, the week of October 12 runs across two pay periods. The workweek still counts as one: Monday to Thursday's 36 hours, in the first period, are counted (never moved), so Friday, the 16th, is what goes past 40
description = "Paid on the 1st and 16th, the week of October 12 runs across two pay periods. The workweek still counts as one: Monday to Thursday's 36 hours, in the first period, are counted (never moved), so Friday, the 16th, is what goes past 40"
punch = [ { at = "2026-10-12 08:00", kind = "in" }, { at = "2026-10-12 17:00", kind = "out" }, { at = "2026-10-13 08:00", kind = "in" }, { at = "2026-10-13 17:00", kind = "out" }, { at = "2026-10-14 08:00", kind = "in" }, { at = "2026-10-14 17:00", kind = "out" }, { at = "2026-10-15 08:00", kind = "in" }, { at = "2026-10-15 17:00", kind = "out" }, { at = "2026-10-16 08:00", kind = "in" }, { at = "2026-10-16 17:00", kind = "out" },]
[policy]zone = "America/Chicago"
# A company paid on the 1st and 16th of the month.[[layer]]id = "semi-monthly-pay"settings = { pay_periods = { month_days = [1, 16] } }
[expect]week = "2026-10-12"allocations = [ "2026-10-12 08:00-17:00 work 9.00", "2026-10-13 08:00-17:00 work 9.00", "2026-10-14 08:00-17:00 work 9.00", "2026-10-15 08:00-17:00 work 9.00", "2026-10-16 08:00-12:00 work 4.00", "2026-10-16 12:00-17:00 overtime 5.00",]
# The second period holds only Friday's lines: the overtime is paid there.[expect.period]day = "2026-10-16"first = "2026-10-16"allocations = ["2026-10-16 08:00-12:00 work 4.00", "2026-10-16 12:00-17:00 overtime 5.00"]A shift from Sunday 22:00 to Monday 06:00 crosses the workweek's end: split at midnight, its two Sunday hours count in the week they were worked (already at 40, so they are overtime) and its six Monday hours start the next week
description = "A shift from Sunday 22:00 to Monday 06:00 crosses the workweek's end: split at midnight, its two Sunday hours count in the week they were worked (already at 40, so they are overtime) and its six Monday hours start the next week"
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 16:00", kind = "out" }, { at = "2026-10-07 08:00", kind = "in" }, { at = "2026-10-07 16:00", kind = "out" }, { at = "2026-10-08 08:00", kind = "in" }, { at = "2026-10-08 16:00", kind = "out" }, { at = "2026-10-09 08:00", kind = "in" }, { at = "2026-10-09 16:00", kind = "out" }, { at = "2026-10-11 22:00", kind = "in" }, { at = "2026-10-12 06:00", kind = "out" },]
[policy]zone = "America/Chicago"
[expect]week = "2026-10-05"worked = "42h"days = { "2026-10-05" = "8h", "2026-10-06" = "8h", "2026-10-07" = "8h", "2026-10-08" = "8h", "2026-10-09" = "8h", "2026-10-11" = "2h" }allocations = [ "2026-10-05 08:00-16:00 work 8.00", "2026-10-06 08:00-16:00 work 8.00", "2026-10-07 08:00-16:00 work 8.00", "2026-10-08 08:00-16:00 work 8.00", "2026-10-09 08:00-16:00 work 8.00", "2026-10-11 22:00-2026-10-12 00:00 overtime 2.00",]
[expect.period]day = "2026-10-12"worked = "6h"allocations = ["2026-10-12 00:00-06:00 work 6.00"]Five eight-hour days are exactly 40 hours: none of it is overtime
description = "Five eight-hour days are exactly 40 hours: none of it is overtime"
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 16:00", kind = "out" }, { at = "2026-10-07 08:00", kind = "in" }, { at = "2026-10-07 16:00", kind = "out" }, { at = "2026-10-08 08:00", kind = "in" }, { at = "2026-10-08 16:00", kind = "out" }, { at = "2026-10-09 08:00", kind = "in" }, { at = "2026-10-09 16:00", kind = "out" },]
[policy]zone = "America/Chicago"
[expect]week = "2026-10-05"worked = "40h"allocations = [ "2026-10-05 08:00-16:00 work 8.00", "2026-10-06 08:00-16:00 work 8.00", "2026-10-07 08:00-16:00 work 8.00", "2026-10-08 08:00-16:00 work 8.00", "2026-10-09 08:00-16:00 work 8.00",]One minute past 40 hours is one minute of overtime: the latest minute of the week, Friday's last. In two decimals it shows as 0.01 hours: hours are carried forward line to line, never rounded up, and what is left under a hundredth at the end of the period is dropped
description = "One minute past 40 hours is one minute of overtime: the latest minute of the week, Friday's last. In two decimals it shows as 0.01 hours: hours are carried forward line to line, never rounded up, and what is left under a hundredth at the end of the period is dropped"
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 16:00", kind = "out" }, { at = "2026-10-07 08:00", kind = "in" }, { at = "2026-10-07 16:00", kind = "out" }, { at = "2026-10-08 08:00", kind = "in" }, { at = "2026-10-08 16:00", kind = "out" }, { at = "2026-10-09 08:00", kind = "in" }, { at = "2026-10-09 16:01", kind = "out" },]
[policy]zone = "America/Chicago"
[expect]week = "2026-10-05"worked = "40h 1m"allocations = [ "2026-10-05 08:00-16:00 work 8.00", "2026-10-06 08:00-16:00 work 8.00", "2026-10-07 08:00-16:00 work 8.00", "2026-10-08 08:00-16:00 work 8.00", "2026-10-09 08:00-16:00 work 8.00", "2026-10-09 16:00-16:01 overtime 0.01",]