The container left the terminal on day 2. The consignee stripped it on day 3 and released the empty to the trucker. The trucker returned it to the depot on day 7. The carrier bills five days of detention to the consignee, because the consignee is the party on the B/L.
Two contracts, one invoice
The carrier's contract is with the consignee (or the forwarder). The trucker's contract is with whoever arranged haulage — under merchant haulage, that is also the consignee or forwarder. The carrier does not care who caused the delay; the detention is owed. But the days after the handover may be recoverable from the trucker under the haulage terms.
So the right response is often two documents: a dispute to the carrier for any days that are genuinely theirs (a wrong clock start, a holiday counted), and a back-charge to the trucker for the days after handover.
The handover timestamp
Everything turns on when the empty was released to the trucker. That is in the consignee's dispatch records or the trucker's own EIR for the pickup of the empty — not in anything the carrier has. If the desk cannot produce it, the split cannot be made and the consignee eats the days.
D&D Pilot marks the handover on the timeline from dispatch records when they are uploaded, allocates the days either side of it, and drafts both documents with the EIR cited. If the haulage contract is in the workspace it reads the back-charge terms; if not, the file says the trucker's liability depends on terms it has not seen.
Carrier haulage is different
When the carrier arranged the inland leg (carrier haulage, door delivery), the trucker is the carrier's subcontractor and the detention days after gate-out are the carrier's problem. Invoices that bill detention on carrier-haulage bookings are disputed on the booking terms, and the file cites the haulage field on the booking confirmation. It is a surprisingly common mix-up when the same forwarder uses both arrangements.