Late changes to a closed period, within limits
The rule
Once a pay period is closed and paid, its timecards no longer change. A correction made afterwards (a forgotten punch, a missed hour) is either taken into the open period as an adjustment, so the money comes out right, or refused, so someone decides what to do. This recipe does both, change by change: small changes made soon after the close are adjusted on their own; large ones, or ones made long after, are refused.
Who uses it
Payroll teams who want routine fixes (a supervisor moving a punch by a quarter hour on Tuesday) to flow without anyone touching them, but want to see the unusual ones before money moves: three hours added to last week, or changes to a period closed a month ago, which may need a manual check, an approval, or a separate off-cycle payment.
How the recipe does it
Configuration only: a package (package.toml) of one layer running the
standard late_changes step, in the late stage: changes of up to an
hour are adjusted, larger ones refused.
[[layer]]id = "late-changes"[[layer.step]]id = "limits"uses = "standard/late_changes"params = { adjust_up_to = "1h" }A company that also refuses changes made too long after the close adds
within (a period from when the period closed) in a layer of its own:
[[layer]]id = "within-a-week"[[layer.step]]id = "limits"change = "params"params = { within = { next = "7d" } }For each day of the open period on which changes to a closed one were
recorded, the engine works out what they make to the closed period’s time
and counts, per category and context. The late stage’s step sees it as
ctx.change: period (the closed period’s first day), day (when the
changes were recorded), closed (when the period closed), time (each
category, context and the time it gains or loses), net,
quantities and balances (what it adds to each accrual balance, through
the periods after, in milliseconds by accrual category); it calls ctx:adjust(why) or ctx:refuse(why). An adjusted
change becomes adjustment lines on that day, stamped with the step; a
refused one is a late_change_refused exception saying why. Without such a
step, the policy’s close.late_changes setting (adjust or refuse) applies
to every change alike.
Parameters
| Parameter | Meaning |
|---|---|
adjust_up_to | The most time a change may move and still be adjusted (each category’s gain or loss counted). |
within | The period from when the period closed in which a change may be recorded and still be adjusted: { next = "7d" }. |
What the scenarios show
small-ones-adjusted-large-ones-refused: 15 minutes moved the day after the close is adjusted into the open week; 3 hours the day after that is refused, the exception saying why. The closed week stays at 40 hours.too-long-after-the-close-is-refused: a 10-minute change recorded seven days after the close is adjusted; the same recorded eight days after is refused.
Legal note
This is a common way companies handle changes after a pay period closes; check the rules where you operate. Where wages are owed, a refused change still has to be paid: refusing only routes it to someone to settle.
Get the recipe
The recipe’s package and its scenarios are in the example packages repository: attendance/late_change_limits. 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 = "late_change_limits"version = "1.0.0"description = "A small change to a pay period already paid is adjusted into the next one on its own; a large one, or one made long after, is refused for payroll to look at."
# A change to a closed period of up to an hour either way is adjusted in# the open period; a larger one is refused.[[layer]]id = "late-changes"[[layer.step]]id = "limits"uses = "standard/late_changes"params = { adjust_up_to = "1h" }Scenarios
Each scenario gives a person’s punches and setup and the timecard they must produce, worked out with this package adopted (the format).
A week closed Monday morning. Tuesday a supervisor moves Friday's out 15 minutes later: within the hour the policy takes on its own, it is adjusted into the open week. Wednesday someone adds three hours to Thursday: more than an hour, refused, for payroll to look at
description = "A week closed Monday morning. Tuesday a supervisor moves Friday's out 15 minutes later: within the hour the policy takes on its own, it is adjusted into the open week. Wednesday someone adds three hours to Thursday: more than an hour, refused, for payroll to look at"
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"
[[close]]period = "2026-10-05"recorded = "2026-10-12 08:00"
[[correction]]recorded = "2026-10-13 10:00"by = "supervisor"reason = "stayed a little late on Friday"move = { punch = "p10", to = "2026-10-09 16:15" }
[[correction]]recorded = "2026-10-14 10:00"by = "supervisor"reason = "worked late Thursday"move = { punch = "p8", to = "2026-10-08 19:00" }
[expect]week = "2026-10-12"allocations = ["2026-10-13 untimed work 0.25"]stamps = ["2026-10-13 00:00-00:15 work: limits [[email protected]/late-changes rev 1]: adjusts the period from 2026-10-05, closed, for changes recorded on 2026-10-13: within the limits for late changes"]exceptions = [{ kind = "late_change_refused", at = "2026-10-14 00:00", detail = "changes recorded on 2026-10-14 to the period from 2026-10-05, closed: it moves more than 1h" }]
[expect.period]day = "2026-10-05"worked = "40h"Paid weekly, the week of October 5 closed on the 12th. A ten-minute fix recorded on the 20th, eight days later, is within the hour but past the seven days the policy allows: refused. The same fix recorded on the 19th, seven days after, would have been adjusted
description = "Paid weekly, the week of October 5 closed on the 12th. A ten-minute fix recorded on the 20th, eight days later, is within the hour but past the seven days the policy allows: refused. The same fix recorded on the 19th, seven days after, would have been 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" },]
[policy]zone = "America/Chicago"
# A company that also refuses changes made more than 7 days after the# close.[[layer]]id = "within-a-week"[[layer.step]]id = "limits"change = "params"params = { within = { next = "7d" } }
[[close]]period = "2026-10-05"recorded = "2026-10-12 08:00"
[[correction]]recorded = "2026-10-19 10:00"by = "supervisor"reason = "a forgotten ten minutes"move = { punch = "p2", to = "2026-10-05 16:10" }
[[correction]]recorded = "2026-10-20 10:00"by = "supervisor"reason = "another forgotten ten minutes"move = { punch = "p4", to = "2026-10-06 16:10" }
[expect]week = "2026-10-19"allocations = ["2026-10-19 untimed work 0.16"]exceptions = [{ kind = "late_change_refused", at = "2026-10-20 00:00" }]