Skip to content

Closing pay periods on their own

The rule

Payroll runs a few days after each pay period ends. By then the period has to be closed: its timecards stop changing, so what payroll pays is what was approved. Rather than someone closing every period by hand, the company closes each one a fixed number of days after it ends. A punch or a correction that comes in after the close does not change the closed period; it is paid in the period that is open, as an adjustment. When payroll has to put a closed period right, it reopens it by hand, and the company’s automatic close leaves that period to payroll from then on.

Who uses it

Any employer whose payroll runs on a fixed day after each period: weekly payrolls processed on Wednesday or Thursday, fortnightly payrolls with a cut-off, and outsourced payroll bureaus that pull the timecards on a set day.

How the recipe does it

Configuration only: a package (package.toml) of one layer, with weekly pay periods and the close.after_days setting: each closes 3 days after it ends.

[[layer]]
id = "close"
settings = { pay_periods = { every_days = 7, from = "2026-10-05" }, close = { after_days = 3 } }

A week ending on Sunday the 11th closes three days after it ends, as Thursday the 15th starts, in the person’s zone. The close is a fact like a close by hand, by automatic: close.after_days, and is told as period.closed. A change recorded after the close goes into the period open then, as adjustment lines (close.late_changes, adjust by default), told as period.adjusted. A period closed or reopened by hand is left as it is, and so is every period before it; the periods after it still close on their own.

The scenarios show time passing with clock steps: the clock moves on to an instant, and the step says which periods are closed then and what was told since the step before:

[[clock]]
to = "2026-10-15 00:00"
closed = ["2026-10-05 automatic"]
events = ["period.closed pay 2026-10-05"]

Parameters

SettingMeaning
close.after_daysHow many days after a period ends it closes, at the start of that workday (0: as it ends). Unset, nothing closes on its own.
close.late_changesWhat a change after the close does: adjust (the default) or refuse.

What the scenarios show

  • a-week-closes-three-days-after-it-ends: open on Wednesday night, closed as Thursday starts.
  • a-late-punch-after-the-close-is-an-adjustment: Friday’s punches, entered on the 16th, after the close, are 8 hours adjusted into the open week; the closed week stays at 32.
  • reopened-by-hand-it-stays-open: payroll reopens the week; the adjustment leaves the open week, the reopened week takes Friday’s hours, and only the next week closes on its own.
  • without-after-days-nothing-closes: with the setting unset, no period closes however long the clock runs.

Closing a period stops its timecards changing; it does not settle what is owed. Wages for hours found after the close are still due, by the next regular payday in most places. Check the rules where you operate.

Get the recipe

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

automatic_close/package.toml
name = "automatic_close"
version = "1.0.0"
description = "Each pay period closes a set number of days after it ends, with no one closing it; a punch that arrives after is paid as an adjustment in the open period, and a period reopened by hand stays open."
# Weekly pay periods from Monday, October 5, 2026, each closed 3 days
# after it ends.
[[layer]]
id = "close"
settings = { pay_periods = { every_days = 7, from = "2026-10-05" }, close = { after_days = 3 } }

Scenarios

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

The week of October 5 closed on its own as the 15th started. Friday's punches, which the clock could not send, are entered on the 16th: too late for the closed week, which stays at 32 hours as paid, they are 8 hours adjusted into the open week, told as period.adjusted
scenarios/a-late-punch-after-the-close-is-an-adjustment.toml
description = "The week of October 5 closed on its own as the 15th started. Friday's punches, which the clock could not send, are entered on the 16th: too late for the closed week, which stays at 32 hours as paid, they are 8 hours adjusted into the open week, told as period.adjusted"
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", recorded = "2026-10-16 09:00" },
{ at = "2026-10-09 16:00", kind = "out", recorded = "2026-10-16 09:00" },
]
[policy]
zone = "America/Chicago"
[[clock]]
to = "2026-10-15 00:00"
closed = ["2026-10-05 automatic"]
events = ["period.closed pay 2026-10-05"]
[[clock]]
to = "2026-10-16 10:00"
closed = ["2026-10-05 automatic"]
events = ["period.adjusted pay 2026-10-12 for 2026-10-05 8.00"]
[expect]
week = "2026-10-12"
allocations = ["2026-10-16 untimed work 8.00"]
[expect.period]
day = "2026-10-05"
worked = "32h"
Paid weekly, each week closes three days after it ends. The week of October 5 ends on Sunday the 11th: on Wednesday night it is still open, and as Thursday the 15th starts it closes on its own, told as period.closed
scenarios/a-week-closes-three-days-after-it-ends.toml
description = "Paid weekly, each week closes three days after it ends. The week of October 5 ends on Sunday the 11th: on Wednesday night it is still open, and as Thursday the 15th starts it closes on its own, told as period.closed"
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"
[[clock]]
to = "2026-10-14 23:59"
closed = []
events = []
[[clock]]
to = "2026-10-15 00:00"
closed = ["2026-10-05 automatic"]
events = ["period.closed pay 2026-10-05"]
[expect.period]
day = "2026-10-05"
worked = "40h"
Payroll reopens the week of October 5 on the 16th, after Friday's late punches were adjusted into the open week. The adjustment leaves the open week and the reopened week takes Friday's 8 hours itself, 40 in all. From then on the policy leaves that week to payroll: it stays open, and only the next week closes on its own, as the 22nd starts
scenarios/reopened-by-hand-it-stays-open.toml
description = "Payroll reopens the week of October 5 on the 16th, after Friday's late punches were adjusted into the open week. The adjustment leaves the open week and the reopened week takes Friday's 8 hours itself, 40 in all. From then on the policy leaves that week to payroll: it stays open, and only the next week closes on its own, as the 22nd starts"
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", recorded = "2026-10-16 09:00" },
{ at = "2026-10-09 16:00", kind = "out", recorded = "2026-10-16 09:00" },
{ at = "2026-10-12 08:00", kind = "in" }, { at = "2026-10-12 16:00", kind = "out" },
]
[policy]
zone = "America/Chicago"
[[close]]
period = "2026-10-05"
recorded = "2026-10-16 12:00"
by = "payroll"
reopen = true
[[clock]]
to = "2026-10-15 00:00"
closed = ["2026-10-05 automatic"]
events = ["period.closed pay 2026-10-05"]
[[clock]]
to = "2026-10-16 10:00"
events = ["period.adjusted pay 2026-10-12 for 2026-10-05 8.00"]
# Reopened: the adjustment leaves the open week.
[[clock]]
to = "2026-10-16 12:00"
closed = []
events = ["period.adjusted pay 2026-10-12 for 2026-10-05 0.00"]
# The reopened week stays open; the next closes on its own.
[[clock]]
to = "2026-10-22 00:00"
closed = ["2026-10-12 automatic"]
events = ["period.closed pay 2026-10-12"]
[expect.period]
day = "2026-10-05"
worked = "40h"
With close.after_days unset, no period closes on its own: seven weeks after the week of October 5 ended it is still open, and nothing was told
scenarios/without-after-days-nothing-closes.toml
description = "With close.after_days unset, no period closes on its own: seven weeks after the week of October 5 ended it is still open, and nothing was told"
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" },
]
[policy]
zone = "America/Chicago"
# A company that closes its periods by hand: its own layer unsets the
# package's close.after_days.
[[layer]]
id = "closed-by-hand"
unset = ["close.after_days"]
[[clock]]
to = "2026-11-30 00:00"
closed = []
events = []