How the Chile feriado anual calculator is verified

Inputs

InputFieldType
Years with your current employerserviceYearsnumber
Years of work counted for progressive leavequalifyingYearsWorkednumber
Work in Magallanes, Aysén or the Province of PalenaaustralRegionboolean
Working days already takendaysTakennumber

The formula

Each derived value below is computed by the Valem engine from the expression shown, in this order. Nothing else runs — there is no hidden code path.

Derived valueFieldFormula (JSONata)
Completed YearscompletedYears$floor($n(serviceYears))
Progressive DaysprogressiveDays($y := $floor($n(qualifyingYearsWorked)) - $const.progressiveFromYears; $y > 0 ? $floor($y / $const.yearsPerExtraDay) : 0)
Days EntitleddaysEntitledcompletedYears < $const.qualifyingServiceYears ? 0 : (australRegion ? $const.daysAustral : $const.daysBase) + progressiveDays
Days RemainingdaysRemaining($r := daysEntitled - $n(daysTaken); $r < 0 ? 0 : $round($r, 1))

Rates and thresholds

The expressions above read these as $const. They are the figures the annual refresh replaces, so they live as data rather than being written into the formulas — which is what makes a year-on-year change a one-line diff instead of an edit to arithmetic.

ConstantValue
daysBase15
daysAustral20
qualifyingServiceYears1
progressiveFromYears10
yearsPerExtraDay3

Test vectors (7)

Every case is executed against this model on each build, by the Java engine and independently by a JavaScript one. A mismatch of a single cent fails the build, so the page cannot ship advertising a figure the model no longer produces.

Case 1 — CH1 under a year with the employer: no annual leave yet

given serviceYears0
given qualifyingYearsWorked0
given australRegionno
given daysTaken0
expect daysEntitled0

Case 2 — CH2 after a year: 15 working days

given serviceYears2
given qualifyingYearsWorked2
given australRegionno
given daysTaken0
expect daysEntitled15

Case 3 — CH3 Magallanes, Aysén or Palena: 20

given serviceYears2
given qualifyingYearsWorked2
given australRegionyes
given daysTaken0
expect daysEntitled20

Case 4 — CH4 ten years of work alone adds nothing yet

given serviceYears10
given qualifyingYearsWorked10
given australRegionno
given daysTaken0
expect progressiveDays0
expect daysEntitled15

Case 5 — CH5 thirteen years: the first progressive day

given serviceYears13
given qualifyingYearsWorked13
given australRegionno
given daysTaken0
expect progressiveDays1
expect daysEntitled16

Case 6 — CH6 twenty-two years: four progressive days

given serviceYears22
given qualifyingYearsWorked22
given australRegionno
given daysTaken0
expect progressiveDays4
expect daysEntitled19

Case 7 — CH7 days taken never push the remainder negative

given serviceYears2
given qualifyingYearsWorked2
given australRegionno
given daysTaken40
expect daysRemaining0

Sources

Check it yourself — and reuse it

The whole model as JSON — inputs, outputs, formulas, vectors and sources in one re-runnable document.

This model is published under CC BY 4.0: use it, adapt it, build on it, with attribution. The licence covers the model — the expression of each rule and the arrangement of the catalog. The rates and thresholds are law, and nobody licenses those; the sources above are where they come from.

← Back to the Chile feriado anual calculator

Built with Valem — a live, verifiable calculator you can fork and embed.