Skip to main content

Function: overageApprovalWeekToPayWeek()

overageApprovalWeekToPayWeek(weekStartIso): string

Defined in: src/lib/dates/index.ts:135

Map an overage approval's stored week_start (the Sunday-anchored billing week the invoice uses) to the ISO Monday week the pay engine keys overage on. Billing weeks (Sunday) and pay weeks (Monday) are offset by one day, so a Sunday billing week S is paid in the Monday week S + 1; this keeps an approved overage both billed to the facility AND paid to the contractor.

Parameters

weekStartIso

string

The Sunday-anchored billing week_start as YYYY-MM-DD.

Returns

string

The Monday-anchored ISO pay-week start (week_start + 1 day) as YYYY-MM-DD.

Throws

DateError if weekStartIso is not a valid YYYY-MM-DD date (propagated from fromISO).

Example

// A Sunday billing week starting 2026-06-21 is paid in the Monday week starting 2026-06-22.
overageApprovalWeekToPayWeek('2026-06-21'); // → '2026-06-22'