Function: thirteenthMonthCentavos()
thirteenthMonthCentavos(
periodBasicCentavos):number
Defined in: src/lib/pay/thirteenthMonth.ts:29
Full-year 13th-month entitlement from the year's per-period basic amounts (centavos).
Sums every pay period's basic pay for the calendar year and returns one twelfth of that total,
per Presidential Decree 851. Inputs are sanitized before summing: each amount is truncated toward
zero (Math.trunc, dropping any fractional centavo) and floored at zero, so negative or fractional
entries cannot reduce or inflate the entitlement. (NaN and +Infinity entries are NOT sanitized and
propagate to the result, yielding NaN or Infinity respectively; -Infinity, like any negative value,
is floored to 0 by Math.max and contributes nothing.) The final divide-by-12 is rounded to the nearest whole
centavo (Math.round). Pure; no I/O or side effects.
Parameters
periodBasicCentavos
readonly number[]
Each pay period's basic pay for the year, in integer centavos (base pay only — excludes allowances, bonuses, the 13th-month itself, and deductions). An empty array yields 0.
Returns
number
The full-year 13th-month entitlement in integer centavos (>= 0 for finite inputs).