Skip to content
Vatsin Workspace
Leave & attendance

Shift detection for rotating shifts: reading every punch as the right shift

Shift detection for rotating shifts, explained: matching punches to the nearest shift, night shifts across midnight, tie-breaks, and a roster to fall back on.

Vatsin Workspace team

Last checked 6 min read

A plant that runs three shifts and rotates crews every week cannot afford to type in a roster for 600 people every Monday. That is where shift detection for rotating shifts comes in: the attendance system looks at when a person actually punched in and works out which shift they were on. Done well, it saves the time office hours a week. Done badly, it marks a night shift worker absent on Monday and present twice on Tuesday.

This post explains how detection works, where it breaks, and the settings that keep it honest.

How shift detection for rotating shifts works

The basic rule is simple. For each employee, the system has a list of shifts they may work, for example:

ShiftStartsEnds
General09:0018:00
A (morning)06:0014:00
B (evening)14:0022:00
C (night)22:0006:00

When the first punch of the day arrives, the system compares it with each start time and picks the closest one, as long as the punch falls inside a window around that start. A punch at 05:48 is shift A. A punch at 13:52 is shift B. A punch at 21:40 is shift C.

Once the shift is chosen, everything else follows from it: the late mark, the half day, early going, and the hours that count as overtime.

Automatic shift assignment: the settings that matter

Windows that do not overlap

Each shift needs a window, say two hours before its start and two hours after. With starts at 06:00, 14:00 and 22:00, two-hour windows never touch. Trouble begins when a company adds a 09:00 general shift with a three-hour window: a 07:30 punch now sits inside both A's and General's ranges.

Two fixes work:

  • Narrower windows for shifts that sit close together.
  • A group per team. Production crews detect only among A, B and C; office staff only have General. A shift a person can never work should not be in their list.

Tie-breaks

Even with good windows, a punch can sit exactly between two starts. Pick one clear tie-break and write it down. "The earlier shift wins" is the most common, because a person who comes early is more likely to be early for that shift than late for the previous one.

Grace stays with the shift

Grace for late coming belongs to the shift, not the person. If shift A allows ten minutes, a 06:09 punch is on time and a 06:11 punch is late, whoever it is.

Night shift attendance across midnight

Night shifts cause most of the errors. A shift that starts at 22:00 on Monday and ends at 06:00 on Tuesday must be booked to Monday. The 06:00 punch on Tuesday closes Monday's shift; it is not Tuesday's first punch.

For that to work, the system must:

  1. know the shift crosses midnight;
  2. look at the previous day's open shift before treating an early morning punch as a new day;
  3. allow an out-punch some hours after the shift end, for people who stay back.

Get this wrong and a night worker shows "absent" on Monday (no punch before midnight closing) and "present, very late" on Tuesday. The comp-off rules and weekly-off counts then go wrong as well, because they read the same days.

The OSH Code also has rules on night work, including conditions for women working at night with their consent. Detection does not change those rules; it only makes sure the hours are booked to the right day.

Rotating shift roster vs detection

Detection is not a replacement for planning. A rotating shift roster tells you who should be on which shift, and you still need one for staffing, canteen counts and transport. The best set-up uses both:

  • Roster exists, punch matches: nothing to do.
  • Roster exists, punch is in another shift's window: flag it to the supervisor as a swap or a mistake. Do not silently overwrite the roster.
  • No roster for the day: let detection pick the shift.

This way, a crew that swaps shifts without telling anyone shows up in a list, instead of quietly breaking the overtime numbers.

Overtime calculation after the shift is settled

Under the OSH Code, ordinary hours are capped at eight a day and work beyond that is paid at twice the ordinary rate of wages, subject to the rules for your establishment. The Code on Wages governs how wages and deductions are worked out.

For overtime calculation, two habits keep the numbers right:

  • Settle the shift first, then count overtime. Overtime is time beyond the chosen shift's end (or beyond the daily limit), so it cannot be counted until the shift is known.
  • Treat early arrival separately. A person who punches at 05:00 for a 06:00 shift has not done an hour of overtime unless the company asked them to come early. Many policies only count overtime after the shift end, or only when it is approved.

Short leave, half days and detection

Detection also affects short absences. If someone takes two hours of permission at the start of shift A and punches at 08:00, a naive system might pick the General shift instead. The fix is to let approved leave and permission win: when a short leave is approved for the morning, detection should still use shift A and simply excuse the first two hours. Our short leave policy guide covers how to stop a permission turning into a late mark as well.

A checklist before you switch it on

  • List the shifts each team can actually work, and nothing else.
  • Set windows so no two start times share a range.
  • Write down the tie-break rule.
  • Mark every shift that crosses midnight.
  • Keep the roster for planning, and send roster-versus-punch differences to supervisors.
  • Count overtime only after the day's shift is settled.
  • Run detection on last month's punches first and compare it with what the time office marked by hand.

That last step is the one most companies skip. A month of real punches shows every overlap and every night-shift edge case before payroll depends on it. In our shift features you set detection groups (who, which shifts, and how many minutes either side of a start count); a roster entry for the day always wins, and each attendance day shows which shift was picked and why. The attendance product brings the punches in from your machines and the phone app.

Sources

Questions people ask

What is automatic shift assignment in attendance?

The system looks at an employee's first punch of the day and picks the shift whose start time is closest, within a window you set. The day is then judged against that shift's timings, grace, half-day and overtime rules, without anyone keying in a roster.

How does night shift attendance work across midnight?

A night shift is booked to the day it starts. A 22:00 to 06:00 shift that begins on Monday is Monday's attendance, and the 06:00 punch on Tuesday closes it. The system needs to know that the shift crosses midnight, or it splits the night into two broken days.

Should we use a roster or shift detection?

Use both. A rotating shift roster is the plan, and detection is the check. Where a roster exists, the punch is compared with it; where it does not, the punch picks the shift. Differences go to the supervisor instead of being silently overwritten.

Can shift detection get overtime wrong?

Yes, if the windows overlap or the shift is picked late in the day. Fix the windows so that each start time has its own range, and calculate overtime only after the shift for the day is settled.

All posts

Book a free demo
Shift detection for rotating shifts: reading every punch as the right shift | Vatsin