Skip to main content

Function: payCycleEndForStart()

payCycleEndForStart(startISO): string | null

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

The pay-cycle end implied by a start date, or null if the start isn't a cycle boundary. Bi-monthly cycles start on the 1st (→ the 15th) or the 16th (→ the last day of the month). Used to auto-fill the "Stop" date picker. Returns null (rather than throwing) for blank/invalid input so it's safe to call on partially-typed date fields.

Parameters

startISO

string

A candidate cycle-start date as YYYY-MM-DD (may be blank or malformed).

Returns

string | null

The matching cycle-end date as YYYY-MM-DD, or null if startISO is unparseable or its day is neither the 1st nor the 16th.