Skip to content

A union contract for its members

The rule

A collective agreement sets its members’ terms over the company’s: here, overtime past 37.5 hours a week instead of 40, and double time past 10 hours in a day. Everyone in the local, or in a shop under it, is covered; everyone else keeps the company’s rule. When the contract is renewed, the new terms apply from the day the new contract takes effect, and the weeks before keep the old ones.

Who uses it

Unionized employers in manufacturing, logistics, healthcare, hospitality and the public sector, in any country with collective bargaining: contracts negotiated by a local, an industry or a sector.

How the recipe does it

Configuration only. The package (package.toml) is the company’s own rule: weekly pay periods, and overtime past 40 hours a week counting regular time only.

[[layer]]
id = "company"
settings = { pay_periods = { every_days = 7, from = "2026-10-05" } }
[[layer.step]]
id = "weekly"
uses = "standard/threshold"
params = { over = "40h", to = "overtime", window = "week", counts = ["work"] }

Each contract is a layer of the tenant’s own, picked by an eligibility rule on the unions hierarchy.

The tenant keeps its unions as a hierarchy (unions): each local, with its shops or units under it. A person’s employment places them in one of them from a day. The contract’s layer applies to everyone in the local or under it:

[[layer]]
id = "local-42"
order = 20
applies_to = "under unions:local-42"
[[layer.step]]
id = "weekly"
change = "params"
params = { over = "37h 30m" }
[[layer.step]]
id = "long-day"
uses = "standard/threshold"
params = { over = "10h", to = "double_time", window = "day" }
before = "weekly"
  • The layer changes the company’s weekly step’s parameters, and adds a daily step before it. The company’s weekly step counts only work, so an hour that is double time is never also overtime.
  • A renewed contract is the layer’s next revision, in force from its first day. Each day is worked out with the revision in force that day, so the weeks before keep the old terms, and a change to a closed pay period is a late change, adjusted or refused as the policy says.
  • A contract whose rule is a different rule altogether replaces the company’s step (change = "replace", with its own uses and params): nothing of the company’s parameters carries over. Local 9’s members are paid every two weeks (the layer’s own pay_periods setting), and their contract counts overtime past 75 hours over the pay period instead of past 40 a week.
  • order = 20 puts the contract after the company’s and any jurisdiction’s layers, so it has the last word on what it changes.
  • Each line’s stamps say which layers gave its step: [[email protected]/company rev 1, local-42 rev 1].

Parameters

SettingMeaning
applies_tounder unions:local-42: the local and every organization under it.
from, revisionWhen a contract’s terms take effect.
The weekly step’s overThe contract’s weekly hours.
The daily step’s over and toWhen a long day turns to double time.

What the scenarios show

  • members-get-the-contracts-week: a member’s 38 hours have half an hour of overtime.
  • another-unions-members-keep-the-company-week: a member of another local works the same 38 hours with none.
  • a-long-day-is-double-time-for-members: a 12-hour day has 2 hours of double time, and the week counts only regular time.
  • the-new-contract-from-its-first-day: 37 hours are no overtime the week before the new contract, and 1 hour the week it starts.
  • a-contract-counts-overtime-by-the-fortnight: 40 hours and 38 hours are 3 hours of overtime over the fortnight, none by the week.

Collective agreements differ in every detail: what counts toward the weekly hours, whether paid leave does, how premiums stack. Model the contract’s own words, and check them with whoever administers it.

Get the recipe

The recipe’s package and its scenarios are in the example packages repository: attendance/union_contract. 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:

union_contract/package.toml
name = "union_contract"
version = "1.0.0"
description = "A collective agreement's shorter week and double time for long days, applied to everyone in the union local or a shop under it, with a new contract taking effect on its first day."
# The company's own rule: weekly pay periods, and overtime past 40 hours
# a week, counting regular time only. Each union's contract is a layer of
# the tenant's, picked by an eligibility rule on the unions hierarchy.
[[layer]]
id = "company"
settings = { pay_periods = { every_days = 7, from = "2026-10-05" } }
[[layer.step]]
id = "weekly"
uses = "standard/threshold"
params = { over = "40h", to = "overtime", window = "week", counts = ["work"] }

Scenarios

Each scenario gives a person’s punches and setup and the timecard they must produce, worked out with this package adopted (the format).

Local 9's contract counts overtime over the two-week pay period instead of the week: past 75 hours a fortnight. Its layer replaces the company's weekly step whole, so nothing of the weekly rule carries over. 40 hours one week and 38 the next are 78: 3 hours of overtime at the end of the fortnight, where the company's weekly rule would have found none
scenarios/a-contract-counts-overtime-by-the-fortnight.toml
description = "Local 9's contract counts overtime over the two-week pay period instead of the week: past 75 hours a fortnight. Its layer replaces the company's weekly step whole, so nothing of the weekly rule carries over. 40 hours one week and 38 the next are 78: 3 hours of overtime at the end of the fortnight, where the company's weekly rule would have found none"
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-12 07:00", kind = "in" }, { at = "2026-10-12 16:30", kind = "out" },
{ at = "2026-10-13 07:00", kind = "in" }, { at = "2026-10-13 16:30", kind = "out" },
{ at = "2026-10-14 07:00", kind = "in" }, { at = "2026-10-14 16:30", kind = "out" },
{ at = "2026-10-15 07:00", kind = "in" }, { at = "2026-10-15 16:30", kind = "out" },
]
[policy]
zone = "America/Chicago"
[[organization]]
hierarchy = "unions"
id = "local-9"
[[employment]]
effective = "2026-01-05"
kind = "hired"
organizations = { unions = "local-9" }
[[layer]]
id = "local-9"
order = 20
applies_to = "under unions:local-9"
settings = { pay_periods = { every_days = 14, from = "2026-10-05" } }
[[layer.step]]
id = "weekly"
change = "replace"
uses = "standard/threshold"
params = { over = "75h", to = "overtime", window = "period" }
[expect.period]
day = "2026-10-05"
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-12 07:00-16:30 work 9.50",
"2026-10-13 07:00-16:30 work 9.50",
"2026-10-14 07:00-16:30 work 9.50",
"2026-10-15 07:00-13:30 work 6.50",
"2026-10-15 13:30-16:30 overtime 3.00",
]
stamps = ["2026-10-15 13:30-16:30 overtime: weekly [[email protected]/company rev 1, local-9 rev 1]: moved 3h from work to overtime: over 75h in the period"]
A member works 12 hours on Monday: past 10 hours is double time under the contract, and the weekly count takes only the regular time that is left
scenarios/a-long-day-is-double-time-for-members.toml
description = "A member works 12 hours on Monday: past 10 hours is double time under the contract, and the weekly count takes only the regular time that is left"
punch = [
{ at = "2026-10-05 06:00", kind = "in" }, { at = "2026-10-05 18: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 12:00", kind = "out" },
]
[policy]
zone = "America/Chicago"
# The unions and their shops, as a hierarchy.
[[organization]]
hierarchy = "unions"
id = "local-42"
[[organization]]
hierarchy = "unions"
id = "shop-1"
parent = "local-42"
[[organization]]
hierarchy = "unions"
id = "local-7"
# The contract with local 42, for everyone in it or a shop under it: a
# 37.5-hour week, and double time past 10 hours a day.
[[layer]]
id = "local-42"
order = 20
applies_to = "under unions:local-42"
[[layer.step]]
id = "weekly"
change = "params"
params = { over = "37h 30m" }
[[layer.step]]
id = "long-day"
uses = "standard/threshold"
params = { over = "10h", to = "double_time", window = "day" }
before = "weekly"
[[employment]]
effective = "2026-01-05"
kind = "hired"
organizations = { unions = "local-42" }
[expect]
week = "2026-10-05"
allocations = [
"2026-10-05 06:00-16:00 work 10.00",
"2026-10-05 16:00-18:00 double_time 2.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-11:30 work 3.50",
"2026-10-09 11:30-12:00 overtime 0.50",
]
A member of local 7, which has no contract here, works the same 38 hours: the company rule applies, and none of it is overtime
scenarios/another-unions-members-keep-the-company-week.toml
description = "A member of local 7, which has no contract here, works the same 38 hours: the company rule applies, and 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 14:00", kind = "out" },
]
[policy]
zone = "America/Chicago"
# The unions and their shops, as a hierarchy.
[[organization]]
hierarchy = "unions"
id = "local-42"
[[organization]]
hierarchy = "unions"
id = "shop-1"
parent = "local-42"
[[organization]]
hierarchy = "unions"
id = "local-7"
# The contract with local 42, for everyone in it or a shop under it: a
# 37.5-hour week, and double time past 10 hours a day.
[[layer]]
id = "local-42"
order = 20
applies_to = "under unions:local-42"
[[layer.step]]
id = "weekly"
change = "params"
params = { over = "37h 30m" }
[[layer.step]]
id = "long-day"
uses = "standard/threshold"
params = { over = "10h", to = "double_time", window = "day" }
before = "weekly"
[[employment]]
effective = "2026-01-05"
kind = "hired"
organizations = { unions = "local-7" }
[expect]
week = "2026-10-05"
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-14:00 work 6.00",
]
A member in a shop under local 42 works 38 hours: the contract makes the last half hour overtime, and the stamp names the union layer that changed the step
scenarios/members-get-the-contracts-week.toml
description = "A member in a shop under local 42 works 38 hours: the contract makes the last half hour overtime, and the stamp names the union layer that changed the step"
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 14:00", kind = "out" },
]
[policy]
zone = "America/Chicago"
# The unions and their shops, as a hierarchy.
[[organization]]
hierarchy = "unions"
id = "local-42"
[[organization]]
hierarchy = "unions"
id = "shop-1"
parent = "local-42"
[[organization]]
hierarchy = "unions"
id = "local-7"
# The contract with local 42, for everyone in it or a shop under it: a
# 37.5-hour week, and double time past 10 hours a day.
[[layer]]
id = "local-42"
order = 20
applies_to = "under unions:local-42"
[[layer.step]]
id = "weekly"
change = "params"
params = { over = "37h 30m" }
[[layer.step]]
id = "long-day"
uses = "standard/threshold"
params = { over = "10h", to = "double_time", window = "day" }
before = "weekly"
[[employment]]
effective = "2026-01-05"
kind = "hired"
organizations = { unions = "shop-1" }
[expect]
week = "2026-10-05"
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-13:30 work 5.50",
"2026-10-09 13:30-14:00 overtime 0.50",
]
stamps = ["2026-10-09 13:30-14:00 overtime: weekly [[email protected]/company rev 1, local-42 rev 1]: moved 30m from work to overtime: over 37h 30m in the week"]
A new contract takes effect on Monday 12 October with a 36-hour week: the layer's second revision is in force from that day. 37 hours the week before are no overtime under the old contract; 37 hours that week are 1 hour of overtime under the new
scenarios/the-new-contract-from-its-first-day.toml
description = "A new contract takes effect on Monday 12 October with a 36-hour week: the layer's second revision is in force from that day. 37 hours the week before are no overtime under the old contract; 37 hours that week are 1 hour of overtime under the new"
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 13:00", kind = "out" },
{ at = "2026-10-12 08:00", kind = "in" }, { at = "2026-10-12 16:00", kind = "out" },
{ at = "2026-10-13 08:00", kind = "in" }, { at = "2026-10-13 16:00", kind = "out" },
{ at = "2026-10-14 08:00", kind = "in" }, { at = "2026-10-14 16:00", kind = "out" },
{ at = "2026-10-15 08:00", kind = "in" }, { at = "2026-10-15 16:00", kind = "out" },
{ at = "2026-10-16 08:00", kind = "in" }, { at = "2026-10-16 13:00", kind = "out" },
]
[policy]
zone = "America/Chicago"
# The unions and their shops, as a hierarchy.
[[organization]]
hierarchy = "unions"
id = "local-42"
[[organization]]
hierarchy = "unions"
id = "shop-1"
parent = "local-42"
[[organization]]
hierarchy = "unions"
id = "local-7"
# The contract with local 42, for everyone in it or a shop under it: a
# 37.5-hour week, and double time past 10 hours a day.
[[layer]]
id = "local-42"
order = 20
applies_to = "under unions:local-42"
[[layer.step]]
id = "weekly"
change = "params"
params = { over = "37h 30m" }
[[layer.step]]
id = "long-day"
uses = "standard/threshold"
params = { over = "10h", to = "double_time", window = "day" }
before = "weekly"
[[employment]]
effective = "2026-01-05"
kind = "hired"
organizations = { unions = "shop-1" }
# The new contract, from its first day.
[[layer]]
id = "local-42"
revision = 2
order = 20
from = "2026-10-12"
applies_to = "under unions:local-42"
[[layer.step]]
id = "weekly"
change = "params"
params = { over = "36h" }
[[layer.step]]
id = "long-day"
uses = "standard/threshold"
params = { over = "10h", to = "double_time", window = "day" }
before = "weekly"
[expect]
week = "2026-10-12"
allocations = [
"2026-10-12 08:00-16:00 work 8.00",
"2026-10-13 08:00-16:00 work 8.00",
"2026-10-14 08:00-16:00 work 8.00",
"2026-10-15 08:00-16:00 work 8.00",
"2026-10-16 08:00-12:00 work 4.00",
"2026-10-16 12:00-13:00 overtime 1.00",
]
stamps = ["2026-10-16 12:00-13:00 overtime: weekly [[email protected]/company rev 1, local-42 rev 2]: moved 1h from work to overtime: over 36h in the week"]
[expect.period]
day = "2026-10-05"
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-13:00 work 5.00",
]