Login-hour limits
Built: 2026-11-02 (the limit itself was built earlier, with the state licence profiles). For the operator, and for whoever maintains the code.
Maharashtra's aggregator rules cap a driver at 12 hours of login in a day, with at least 10 hours of rest between shifts. The central guidelines (MVAG) set no limit, so the rule is per region.
Setting it (Admin → Zones → a region)
- Hours. The most a driver may be logged in within any 24 hours (1–24).
- Rest after the limit. The hours a driver must rest after reaching it (1–24). It needs the limit, and shows as a chip, for example "rest 10h".
The smallest region at the driver's position that sets a limit decides.
What happens
- Online time comes from the driver's own status log (the hours report). Time on a trip counts.
- Going online past the limit is refused. A driver online past it is signed out by a sweep every 10 minutes, but never mid-trip.
- With a rest period:
- a driver signed out at the limit rests from that moment;
- a driver who stopped at the limit by themselves rests from when they went offline.
- Until the rest ends, going online is refused with the time they may come back, even once the rolling 24 hours drop under the limit. Without it, a rolling window can let a driver back within minutes.
- Every time the limit is reached, an event is kept
(
driver_hours_cap_events): the driver, region, sign-out or refusal, minutes logged in, and the rest end.
What the driver sees
Home shows a pill wherever a limit applies:
- "Logged in 9h 20m of 12h · 2h 40m left". It turns amber in the last hour.
- "12-hour limit reached — take a break".
- "Rest until Mon 8:24 AM".
A refusal says why, with the time, in the driver's language. A sign-out also arrives as a push and a socket event.
The report (Admin → Reports → Login-hour limits)
For the last 30 days:
- per region: sign-outs, refusals and drivers;
- the latest events: the driver, what happened, logged in (for example "13h 05m / 12h"), and rest until;
- a CSV of every event, for the state.
Code
| Piece | Where |
|---|---|
| Rule | backend/src/geo/region-rules.ts (hours.maxOnlinePer24h, hours.minRestHours; hoursCapAt) |
| Limit, rest, sweep, events | drivers/driver-hours-cap.service.ts |
| Driver endpoint | GET /drivers/me/hours/limit |
| Report | drivers/login-hours-report.service.ts, GET /reports/login-hours |
| Migration | 1700000117000-LoginHourEvents |
| Driver app | src/components/LoginLimit.tsx (home); src/lib/api.ts puts the time from until into refusals |
| Admin | zones/RegionFields.tsx; components/reports/LoginHoursCard.tsx |
Not built
- Working across several apps. Maharashtra is considering a limit on bike-taxi riders who work for several apps. That needs the state's shared register.
United States (added 2026-11-04)
US fatigue rules are set the same way, per city or state region:
- Chicago / Illinois: at most 10 hours online in any 24. Set Hours = 10. If the platform's policy also has a rest period, add it, for example Rest after the limit = 6.
- Platform policy elsewhere: the common industry policy is 12 hours and then 6 hours offline. Set it on a market-wide region if no local law sets one.
This was verified end to end with a US-style rule (a limit, then 6 hours' rest):
- going online past the limit is refused with
login_hours_cap; - the refusal is kept in
driver_hours_cap_events; - the driver's limit endpoint returns the cap, the rest hours and the time the rest ends.
The script is hourscap-us-e2e.mjs.
Check each city's current ordinance before you set the numbers.