Skip to content

Rounding that leaves meal punches alone

The rule

The punches that start and end the day are rounded (here to the quarter hour, 7 minutes down and 8 up). The punches out to and back from a meal are not: a 29-minute lunch stays 29 minutes, never rounded into a 30-minute one or out of one.

Who uses it

Employers who round the day’s punches but must show that a full meal period was taken (where a meal shorter than 30 minutes, or taken late, has consequences), and employers who simply do not want rounding to move unpaid meal time.

How the recipe does it

Configuration only: a package (package.toml) of one layer. The standard round step takes the punch kinds it rounds. The categories are the tenant’s own setup.

[[layer]]
id = "rounding"
settings = { categories = { lunch = "meal" } } # lunch segments are allocated, to an unpaid category
[[layer.step]]
id = "round"
uses = "standard/round"
params = { interval = "15m", mode = "7m", punches = ["in", "out"] }
[[category]]
id = "meal"
worked = false
paid = false

With punches = ["in", "out"], a segment’s start is rounded only when it began with an in punch, and its end only when it ended with an out punch. The work before lunch keeps its lunch_start end, the lunch both of its punches, and the work after lunch its lunch_end start.

Setting categories.lunch puts lunch on the timecard as its own line, in a category that is neither worked nor paid.

Parameters

ParameterMeaning
interval, modeAs in seven_minute_rounding.
punchesThe punch kinds rounded: ["in", "out"]. Others are lunch_start, lunch_end, break_start, break_end, transfer, unknown.

What the scenarios show

  • meal-punches-as-punched: in and out rounded, the 29-minute lunch kept.
  • rounding-every-punch-would-shorten-the-meal: the same day with every punch rounded turns it into 12:00 to 12:30, which is why the recipe exists.

This is a common way companies implement rounding alongside meal periods; check the rules where you operate. Some places do not allow rounding meal punches at all.

Get the recipe

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

rounding_without_meals/package.toml
name = "rounding_without_meals"
version = "1.0.0"
description = "The day's in and out punches round to the quarter hour; lunch punches stay exactly as punched, so the meal taken is the meal on the timecard."
# Lunch segments go to "meal". In and out punches are rounded to the
# quarter hour (down up to 7 minutes past, up after); lunch punches are
# kept as punched.
[[layer]]
id = "rounding"
settings = { categories = { lunch = "meal" } }
[[layer.step]]
id = "round"
uses = "standard/round"
params = { interval = "15m", mode = "7m", punches = ["in", "out"] }

Scenarios

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

In and out punches round to the quarter hour (7 minutes down, 8 up); lunch punches stay as punched, so the meal is exactly as long as it was taken: in 07:53 is 08:00, lunch 12:02 to 12:31 stays 29 minutes, out 16:37 is 16:30
scenarios/meal-punches-as-punched.toml
description = "In and out punches round to the quarter hour (7 minutes down, 8 up); lunch punches stay as punched, so the meal is exactly as long as it was taken: in 07:53 is 08:00, lunch 12:02 to 12:31 stays 29 minutes, out 16:37 is 16:30"
punch = [
{ at = "2026-10-05 07:53", kind = "in" },
{ at = "2026-10-05 12:02", kind = "lunch_start" },
{ at = "2026-10-05 12:31", kind = "lunch_end" },
{ at = "2026-10-05 16:37", kind = "out" },
]
[policy]
zone = "America/Chicago"
[[category]]
id = "meal"
worked = false
paid = false
[expect]
week = "2026-10-05"
worked = "8h 1m"
segments = [
"work 2026-10-05 08:00-12:02",
"lunch 2026-10-05 12:02-12:31",
"work 2026-10-05 12:31-16:30",
]
allocations = [
"2026-10-05 08:00-12:02 work 4.03",
"2026-10-05 12:02-12:31 meal 0.48",
"2026-10-05 12:31-16:30 work 3.98",
]
The same day with every punch rounded, for comparison: the 29-minute lunch becomes 12:00 to 12:30, so the meal on the timecard is not the meal taken. This is what leaving meal punches alone avoids
scenarios/rounding-every-punch-would-shorten-the-meal.toml
description = "The same day with every punch rounded, for comparison: the 29-minute lunch becomes 12:00 to 12:30, so the meal on the timecard is not the meal taken. This is what leaving meal punches alone avoids"
punch = [
{ at = "2026-10-05 07:53", kind = "in" },
{ at = "2026-10-05 12:02", kind = "lunch_start" },
{ at = "2026-10-05 12:31", kind = "lunch_end" },
{ at = "2026-10-05 16:37", kind = "out" },
]
[policy]
zone = "America/Chicago"
# A company that rounds every punch, lunch punches too.
[[layer]]
id = "every-punch"
[[layer.step]]
id = "round"
change = "replace"
uses = "standard/round"
params = { interval = "15m", mode = "7m" }
[[category]]
id = "meal"
worked = false
paid = false
[expect]
week = "2026-10-05"
worked = "8h"
segments = [
"work 2026-10-05 08:00-12:00",
"lunch 2026-10-05 12:00-12:30",
"work 2026-10-05 12:30-16:30",
]