Skip to main content

Function: variancePercent()

variancePercent(contractedHours, actualHours): number

Defined in: src/lib/invoice/index.ts:178

Variance of worked-vs-contracted as a percentage (0 contracted → 0%, or 100% if any worked).

Parameters

contractedHours

number

The contracted weekly hours (the denominator).

actualHours

number

Hours actually worked in the week.

Returns

number

|actual − contracted| ÷ contracted × 100, rounded to one decimal place. When contractedHours ≤ 0: returns 100 if any hours were worked, otherwise 0.