How the Norway feriefritid calculator is verified

Inputs

InputFieldType
Days you work per weekdaysPerWeeknumber
Your age during the holiday yearagenumber
I started after 30 September of the holiday yearstartedAfterSep30boolean
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)
Base VirkedagerbaseVirkedager(startedAfterSep30 = true ? $const.lateStartVirkedager : $const.statutoryVirkedager)
Extra VirkedagerextraVirkedager($n(age) >= $const.age60Threshold ? $const.extraVirkedagerAge60 : 0)
Total VirkedagertotalVirkedagerbaseVirkedager + extraVirkedager
Full WeeksfullWeeks$floor(totalVirkedager / $const.statutoryBasisDays)
Remainder DaysremainderDaystotalVirkedager - fullWeeks * $const.statutoryBasisDays
Days EntitleddaysEntitled$round(fullWeeks * $n(daysPerWeek) + remainderDays, 1)
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
statutoryVirkedager25
statutoryBasisDays6
extraVirkedagerAge606
age60Threshold60
lateStartVirkedager6

Test vectors (8)

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 — J1 a five-day week is 21 days — four weeks plus the one day over, not 25

given daysPerWeek5
given age40
given startedAfterSep30no
given daysTaken0
expect totalVirkedager25
expect fullWeeks4
expect remainderDays1
expect daysEntitled21

Case 2 — J2 a six-day week reproduces the statutory figure exactly

given daysPerWeek6
given age40
given startedAfterSep30no
given daysTaken0
expect daysEntitled25

Case 3 — J3 § 5(2): turning 60 adds six virkedager, which is a sixth week

given daysPerWeek5
given age60
given startedAfterSep30no
given daysTaken0
expect extraVirkedager6
expect totalVirkedager31
expect fullWeeks5
expect daysEntitled26

Case 4 — J4 the bonus starts AT 60, so 59 is still the ordinary entitlement

given daysPerWeek5
given age59
given startedAfterSep30no
given daysTaken0
expect extraVirkedager0
expect daysEntitled21

Case 5 — J5 § 5(3): starting after 30 September is six virkedager, one week

given daysPerWeek5
given age40
given startedAfterSep30yes
given daysTaken0
expect baseVirkedager6
expect fullWeeks1
expect remainderDays0
expect daysEntitled5

Case 6 — J6 a late starter over 60 still gets the § 5(2) bonus on top

given daysPerWeek5
given age62
given startedAfterSep30yes
given daysTaken0
expect totalVirkedager12
expect daysEntitled10

Case 7 — J7 a three-day week: four weeks plus the day over

given daysPerWeek3
given age40
given startedAfterSep30no
given daysTaken0
expect daysEntitled13

Case 8 — J8 days already taken come off the remainder, and it never goes negative

given daysPerWeek5
given age40
given startedAfterSep30no
given daysTaken30
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 Norway feriefritid calculator

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