Snap early punches to the scheduled start
The rule
People arrive a little early and clock in on the way to their station. Work starts at the scheduled time, so an in punch up to a grace period (say 10 minutes) before the shift’s start is taken at the start. In the same way, an out punch up to a grace after the shift’s end may be taken at the end. Any other punch counts as punched: earlier than the grace (the person may have been asked to start early), late arrivals, early departures, and punches on a day with no shift.
Who uses it
Employers with fixed schedules (manufacturing, call centers, retail openings) who do not want to pay, or argue about, the minutes between clocking in and the start of the shift, while still paying any real early start or late finish.
How the recipe does it
Configuration only: the package (package.toml) has one layer for
everyone with two standard steps, match saying which shift each piece
of work is of, then grace:
[[layer]]id = "snap"[[layer.step]]id = "match"uses = "standard/match"params = { early = "30m" } # work starting up to 30 minutes early is the shift's
[[layer.step]]id = "snap"uses = "standard/grace"params = { in_early = "10m", out_late = "10m" }For work that belongs to a scheduled shift, an in punch from in_early
before the start up to the start is taken at the start, and an out
punch from the end up to out_late after it is taken at the end. The
step’s other two sides, a late in (in_late) and an early out
(out_early), are left off, so those punches stay as punched. Lunch and
break punches are not in or out punches, so they are never moved. The
raw punch is kept, and the ledger stamps each change with what it was.
The match step (in the match stage, before any time step) decides how
early work may start and still be the shift’s, and stamps where that
differs from the engine’s own rule; its early must be at least the grace,
or an early punch would find no shift to snap to. (The policy setting
shifts.early does the same for every shift, without a step; the match
step can also prefer the nearest of two shifts, see the shift matching
recipe.)
A tenant that snaps only the in punch gives the step its own parameters in a layer of its own:
[[layer]]id = "no-out-grace"order = 20[[layer.step]]id = "snap"change = "params"params = { out_late = "0s" }Parameters
| Step | Parameter | Meaning |
|---|---|---|
match | early | How early work may start and still be the shift’s ("30m"). |
snap | in_early | How long before the shift’s start an in punch is taken at the start ("10m"). |
snap | out_late | How long after the shift’s end an out punch is taken at the end ("10m"; "0s" never moves an out punch). |
What the scenarios show
within-the-grace-and-outside-it: exactly 10 minutes early snaps, 11 does not; the same at the end; a late in and an early out stay.no-shift-and-lunch-punches: no shift, no snap; lunch punches and the return from lunch are never moved; a tenant layer turningout_lateoff leaves out punches as punched.
Legal note
This is a common way companies implement snapping punches to the schedule; check the rules where you operate. Time a person actually works before or after the shift, at the employer’s request or with its knowledge, is generally work time and must be paid.
Get the recipe
The recipe’s package and its scenarios are in the example packages repository: attendance/snap_to_schedule. 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 = "snap_to_schedule"version = "1.0.0"description = "An in punch up to 10 minutes before the shift is paid from its start, and an out punch up to 10 minutes after it to its end; everything else as punched."
# Everyone: work starting up to 30 minutes early is the shift's, so an# early in has a shift to snap to; then an in up to 10 minutes before the# shift's start is taken at the start, and an out up to 10 minutes after# its end at the end.[[layer]]id = "snap"[[layer.step]]id = "match"uses = "standard/match"params = { early = "30m" }
[[layer.step]]id = "snap"uses = "standard/grace"params = { in_early = "10m", out_late = "10m" }Scenarios
Each scenario gives a person’s punches and setup and the timecard they must produce, worked out with this package adopted (the format).
Only an in punch and an out punch near a shift snap. Saturday has no shift: 07:55 stays. On Monday, back from lunch at 12:25 is not an in punch and stays; only the day's first in (07:55) and last out (16:05) snap. Without `late`, out punches never snap
description = "Only an in punch and an out punch near a shift snap. Saturday has no shift: 07:55 stays. On Monday, back from lunch at 12:25 is not an in punch and stays; only the day's first in (07:55) and last out (16:05) snap. Without `late`, out punches never snap"
punch = [ { at = "2026-10-05 07:55", kind = "in" }, { at = "2026-10-05 12:00", kind = "lunch_start" }, { at = "2026-10-05 12:25", kind = "lunch_end" }, { at = "2026-10-05 16:05", kind = "out" }, { at = "2026-10-10 07:55", kind = "in" }, { at = "2026-10-10 12:00", kind = "out" },]
[policy]zone = "America/Chicago"
[[shift_definition]]id = "days"start = "08:00"end = "16:00"days = ["monday", "tuesday", "wednesday", "thursday", "friday"]
# Without the grace after the shift's end: out punches are never moved.[[layer]]id = "no-out-grace"order = 20[[layer.step]]id = "snap"change = "params"params = { out_late = "0s" }
[expect]week = "2026-10-05"segments = [ "work 2026-10-05 08:00-12:00", "lunch 2026-10-05 12:00-12:25", "work 2026-10-05 12:25-16:05", "work 2026-10-10 07:55-12:00",]The shift is 08:00 to 16:00 and the grace 10 minutes either side. In at 07:50 (exactly the grace) is taken at 08:00, in at 07:49 (a minute outside) stays; out at 16:10 is taken at 16:00, out at 16:11 stays; a late in at 08:04 and an early out at 15:55 stay as punched
description = "The shift is 08:00 to 16:00 and the grace 10 minutes either side. In at 07:50 (exactly the grace) is taken at 08:00, in at 07:49 (a minute outside) stays; out at 16:10 is taken at 16:00, out at 16:11 stays; a late in at 08:04 and an early out at 15:55 stay as punched"
punch = [ { at = "2026-10-05 07:50", kind = "in" }, { at = "2026-10-05 16:10", kind = "out" }, { at = "2026-10-06 07:49", kind = "in" }, { at = "2026-10-06 16:11", kind = "out" }, { at = "2026-10-07 08:04", kind = "in" }, { at = "2026-10-07 15:55", kind = "out" },]
[policy]zone = "America/Chicago"
[[shift_definition]]id = "days"start = "08:00"end = "16:00"days = ["monday", "tuesday", "wednesday", "thursday", "friday"]
[expect]week = "2026-10-05"segments = [ "work 2026-10-05 08:00-16:00", "work 2026-10-06 07:49-16:11", "work 2026-10-07 08:04-15:55",]# The early starts are the shift's because the match step says so (by the# engine's own rule they would be no shift's): stamped.stamps = [ "2026-10-05 08:00-16:00 work: match [[email protected]/snap rev 1]: matched to shift days@2026-10-05: within the shift's window", "2026-10-05 08:00-16:00 work: snap [[email protected]/snap rev 1]: start 07:50:00 to 08:00:00: in up to 10m before the shift", "2026-10-05 08:00-16:00 work: snap [[email protected]/snap rev 1]: end 16:10:00 to 16:00:00: out up to 10m after the shift", "2026-10-06 07:49-16:11 work: match [[email protected]/snap rev 1]: matched to shift days@2026-10-06: within the shift's window",]