Skip to main content

Function: healthAllowanceDueDate()

healthAllowanceDueDate(startDateISO): string

Defined in: src/lib/pay/healthAllowance.ts:40

The date a contractor becomes due their health allowance: hire date + 6 months (calendar months, with end-of-month clamping). Input/output are YYYY-MM-DD. Pure + timezone-free (date-only math).

Parameters

startDateISO

string

The contractor's hire/start date. Must begin with YYYY-MM-DD; if it does not match that shape the input is returned unchanged (no throw) — callers should treat that as "no computable due date" rather than a valid result.

Returns

string

The eligibility/due date as YYYY-MM-DD, or the original startDateISO verbatim if it was not in the expected format.

Remarks

The 6-month offset comes from HEALTH_ALLOWANCE_ELIGIBLE_AFTER_MONTHS. Month arithmetic carries into the year, and the day is clamped to the last day of the target month so e.g. an Aug 31 start yields …-02-28/-02-29 rather than overflowing into March. Only the leading YYYY-MM-DD of the input is parsed; any trailing time/zone text is ignored. The function does not validate that the date is a real calendar date.

Example

healthAllowanceDueDate('2025-01-15'); // '2025-07-15'
healthAllowanceDueDate('2025-08-31'); // '2026-02-28' (clamped to end of Feb)