Skip to content

Late arrival and early departure, with a grace period

The rule

A person scheduled for a shift is late when they clock in more than a grace period (say five minutes) after it starts, and leaves early when their last clock-out of the shift is more than the grace before it ends. Either is flagged for a supervisor. Going to lunch or on a break is neither.

Who uses it

Any employer that schedules shifts and tracks attendance: manufacturing lines, call centres, retail and hospitals, where a late start or an early leave leaves a post uncovered. The flags feed attendance reviews, points systems and approval of the timecard.

How the recipe does it

Configuration only: a package (package.toml) of one layer running the standard late and early steps, each with 5 minutes’ grace.

[[layer]]
id = "attendance"
[[layer.step]]
id = "late"
uses = "standard/late"
params = { grace = "5m" }
[[layer.step]]
id = "early"
uses = "standard/early"
params = { grace = "5m" }
  • late looks at the first work of each shift: if it was started by an in punch more than grace after the shift’s start, it raises late.
  • early looks at the last work of each shift on its workday: if it ended with an out punch more than grace before the shift’s end, it raises left_early. Work ended by a lunch or break punch, or an out before coming back, is no departure.

Only the first work of a shift is held to its start, so a person who clocks out and in for lunch (rather than lunch_start and lunch_end) is not flagged late on coming back.

Both use raw punch times, not rounded ones, and raise exceptions only about their own workday’s work. An exception about a stretch of work is shown at its start.

Parameters

StepParameterMeaning
bothgraceHow far past the start, or before the end, is still on time: "5m" (default none).

What the scenarios show

  • at-the-grace-and-one-minute-past: in at 08:05 and out at 15:55 are on time; 08:06 is late; 15:54 left early.
  • out-to-lunch-is-not-leaving: a lunch out and back is no departure; the day’s last out, half an hour early, is.
  • a-night-shift-across-midnight: a night shift’s early out the next morning is about the workday the shift started on.
  • back-from-an-out-and-in-lunch-is-not-late: coming back from a lunch punched out and in is not late; a late first in is.

This is a common way companies implement attendance flags; check the rules where you operate. Being flagged changes no one’s pay: rounding, pay for the time actually worked and any discipline follow their own rules.

Get the recipe

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

late_and_early/package.toml
name = "late_and_early"
version = "1.0.0"
description = "An exception when someone starts a scheduled shift late or leaves it early, past a few minutes' grace."
# Starting a shift more than 5 minutes after its start is late; ending it
# more than 5 minutes before its end is leaving early.
[[layer]]
id = "attendance"
[[layer.step]]
id = "late"
uses = "standard/late"
params = { grace = "5m" }
[[layer.step]]
id = "early"
uses = "standard/early"
params = { grace = "5m" }

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 22:00 to 06:00 night shift ends the next morning: Monday night's out at 05:55 is within the grace, Tuesday night's at 05:50 left early, an exception of Tuesday's workday, where the shift started
scenarios/a-night-shift-across-midnight.toml
description = "A 22:00 to 06:00 night shift ends the next morning: Monday night's out at 05:55 is within the grace, Tuesday night's at 05:50 left early, an exception of Tuesday's workday, where the shift started"
punch = [
{ at = "2026-10-05 22:00", kind = "in" }, { at = "2026-10-06 05:55", kind = "out" },
{ at = "2026-10-06 22:00", kind = "in" }, { at = "2026-10-07 05:50", kind = "out" },
]
[policy]
zone = "America/Chicago"
[[shift_definition]]
id = "nights"
start = "22:00"
end = "06:00"
days = ["monday", "tuesday"]
[expect]
week = "2026-10-05"
exceptions = [{ kind = "left_early", at = "2026-10-06 22:00" }]
A 08:00 to 16:00 shift with five minutes' grace each way: Monday in at 08:05 and out at 15:55, exactly at the grace, is neither late nor early; Tuesday in at 08:06 is late; Wednesday out at 15:54 left early. Each exception is about the stretch of work, where it starts
scenarios/at-the-grace-and-one-minute-past.toml
description = "A 08:00 to 16:00 shift with five minutes' grace each way: Monday in at 08:05 and out at 15:55, exactly at the grace, is neither late nor early; Tuesday in at 08:06 is late; Wednesday out at 15:54 left early. Each exception is about the stretch of work, where it starts"
punch = [
{ at = "2026-10-05 08:05", kind = "in" }, { at = "2026-10-05 15:55", kind = "out" },
{ at = "2026-10-06 08:06", kind = "in" }, { at = "2026-10-06 16:00", kind = "out" },
{ at = "2026-10-07 08:00", kind = "in" }, { at = "2026-10-07 15:54", kind = "out" },
]
[policy]
zone = "America/Chicago"
[[shift_definition]]
id = "days"
start = "08:00"
end = "16:00"
days = ["monday", "tuesday", "wednesday"]
[expect]
week = "2026-10-05"
exceptions = [
{ kind = "late", at = "2026-10-06 08:06" },
{ kind = "left_early", at = "2026-10-07 08:00" },
]
A clock with only in and out: the person punches out for lunch at 12:00 and in again at 12:30. Coming back from lunch is no late arrival: only the first work of the shift is held to its start. Tuesday's first in, at 08:10, is late
scenarios/back-from-an-out-and-in-lunch-is-not-late.toml
description = "A clock with only in and out: the person punches out for lunch at 12:00 and in again at 12:30. Coming back from lunch is no late arrival: only the first work of the shift is held to its start. Tuesday's first in, at 08:10, is late"
punch = [
{ at = "2026-10-05 08:00", kind = "in" }, { at = "2026-10-05 12:00", kind = "out" },
{ at = "2026-10-05 12:30", kind = "in" }, { at = "2026-10-05 16:00", kind = "out" },
{ at = "2026-10-06 08:10", kind = "in" }, { at = "2026-10-06 12:00", kind = "out" },
{ at = "2026-10-06 12:30", kind = "in" }, { at = "2026-10-06 16:00", kind = "out" },
]
[policy]
zone = "America/Chicago"
[[shift_definition]]
id = "days"
start = "08:00"
end = "16:00"
days = ["monday", "tuesday"]
[expect]
week = "2026-10-05"
exceptions = [{ kind = "late", at = "2026-10-06 08:10" }]
Out to lunch at noon and back at 12:30 is no early departure: only the day's last stretch of work is held to the shift's end, and it ends on time. Thursday's last out, at 15:30, is early
scenarios/out-to-lunch-is-not-leaving.toml
description = "Out to lunch at noon and back at 12:30 is no early departure: only the day's last stretch of work is held to the shift's end, and it ends on time. Thursday's last out, at 15:30, is early"
punch = [
{ at = "2026-10-07 08:00", kind = "in" }, { at = "2026-10-07 12:00", kind = "lunch_start" },
{ at = "2026-10-07 12:30", kind = "lunch_end" }, { at = "2026-10-07 16:00", kind = "out" },
{ at = "2026-10-08 08:00", kind = "in" }, { at = "2026-10-08 12:00", kind = "lunch_start" },
{ at = "2026-10-08 12:30", kind = "lunch_end" }, { at = "2026-10-08 15:30", kind = "out" },
]
[policy]
zone = "America/Chicago"
[[shift_definition]]
id = "days"
start = "08:00"
end = "16:00"
days = ["wednesday", "thursday"]
[expect]
week = "2026-10-05"
exceptions = [{ kind = "left_early", at = "2026-10-08 12:30" }]