Function: payPeriodForDate()
payPeriodForDate(
d,contractorType,assignmentEndDate?):BiMonthlyPeriod
Defined in: src/lib/pay/index.ts:247
The bi-monthly period whose pay run actually PAYS a given entry date — which is not always the calendar period containing it. Mirrors calculateContractorPay's dispatch exactly:
in_house_admin→ the calendar period (in-house pay is period-level).- outsourced with the assignment ending on or before the calendar period's end → the calendar period (the terminating run day-prorates the calendar window).
- outsourced otherwise → the period holding the date's ISO-week SUNDAY (weekly settling,
ADR-0044) — so a period's tail days past its last Sunday settle in the NEXT period's run.
Anything asking "which run pays / paid this date" (e.g. stranded-late-hours detection, ADR-0056)
must use this, never
periodForDatealone.