How the Czechia dovolená calculator is verified

Inputs

InputFieldType
EmployeremployerTypestring
Weekly working hoursweeklyHoursnumber
Working days in your weekdaysPerWeeknumber
Weeks worked in the calendar yearweeksWorkednumber
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)
Leave WeeksleaveWeeksemployerType = 'teacher' ? $const.weeksTeacher : (employerType = 'public' ? $const.weeksPublic : $const.weeksPrivate)
Leave HoursleaveHours($w := $n(weeksWorked); $w := $w > $const.weeksInYear ? $const.weeksInYear : ($w < 0 ? 0 : $floor($w)); $w < $const.minWeeksForProRata ? 0 : $round($n(weeklyHours) * leaveWeeks * $w / $const.weeksInYear, 2))
Days EntitleddaysEntitled($d := $n(daysPerWeek); $h := $n(weeklyHours); $h > 0 and $d > 0 ? $round(leaveHours / ($h / $d), 1) : 0)
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
weeksPrivate4
weeksPublic5
weeksTeacher8
weeksInYear52
minWeeksForProRata4

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 — CZ1 a full year at 40 hours: 160 hours, 20 days

given employerTypeprivate
given weeklyHours40
given daysPerWeek5
given weeksWorked52
given daysTaken0
expect leaveHours160
expect daysEntitled20

Case 2 — CZ2 public employer: 5 weeks, 200 hours, 25 days

given employerTypepublic
given weeklyHours40
given daysPerWeek5
given weeksWorked52
given daysTaken0
expect leaveHours200
expect daysEntitled25

Case 3 — CZ3 a teacher: 8 weeks, 40 days

given employerTypeteacher
given weeklyHours40
given daysPerWeek5
given weeksWorked52
given daysTaken0
expect daysEntitled40

Case 4 — CZ4 26 weeks worked: half, 80 hours

given employerTypeprivate
given weeklyHours40
given daysPerWeek5
given weeksWorked26
given daysTaken0
expect leaveHours80
expect daysEntitled10

Case 5 — CZ5 three weeks worked: no leave yet

given employerTypeprivate
given weeklyHours40
given daysPerWeek5
given weeksWorked3
given daysTaken0
expect leaveHours0

Case 6 — CZ6 part-time 20 hours over 4 days: 80 hours, still 16 days

given employerTypeprivate
given weeklyHours20
given daysPerWeek4
given weeksWorked52
given daysTaken0
expect leaveHours80
expect daysEntitled16

Case 7 — CZ7 never negative

given employerTypeprivate
given weeklyHours40
given daysPerWeek5
given weeksWorked52
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 Czechia dovolená calculator

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