How the South Korea 연차 유급휴가 calculator is verified

Inputs

InputFieldType
Years of continuous serviceserviceYearsnumber
Attended at least 80% of the last yearattendance80boolean
Months of perfect attendance (first year, or under 80%)perfectAttendanceMonthsnumber
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))
Days EntitleddaysEntitled($m := $n(perfectAttendanceMonths); $m := $m > 12 ? 12 : ($m < 0 ? 0 : $floor($m)); (completedYears < 1 or $not(attendance80)) ? $m * $const.daysPerPerfectMonth : (completedYears >= $const.longServiceFromYears ? ($d := $const.daysFullYear + $floor((completedYears - 1) / $const.yearsPerExtraDay); $d > $const.maxDays ? $const.maxDays : $d) : $const.daysFullYear))
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
daysFullYear15
daysPerPerfectMonth1
longServiceFromYears3
yearsPerExtraDay2
maxDays25

Test vectors (9)

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 — K1 one year at 80%+ attendance: 15 days

given serviceYears1
given attendance80yes
given perfectAttendanceMonths0
given daysTaken0
expect daysEntitled15

Case 2 — K2 still 15 at two years

given serviceYears2
given attendance80yes
given perfectAttendanceMonths0
given daysTaken0
expect daysEntitled15

Case 3 — K3 three years adds the first extra day: 16

given serviceYears3
given attendance80yes
given perfectAttendanceMonths0
given daysTaken0
expect daysEntitled16

Case 4 — K4 five years: 17

given serviceYears5
given attendance80yes
given perfectAttendanceMonths0
given daysTaken0
expect daysEntitled17

Case 5 — K5 21 years reaches the 25-day cap

given serviceYears21
given attendance80yes
given perfectAttendanceMonths0
given daysTaken0
expect daysEntitled25

Case 6 — K6 and the cap holds at 30 years

given serviceYears30
given attendance80yes
given perfectAttendanceMonths0
given daysTaken0
expect daysEntitled25

Case 7 — K7 first year: one day per month of perfect attendance

given serviceYears0
given attendance80yes
given perfectAttendanceMonths7
given daysTaken0
expect daysEntitled7

Case 8 — K8 under 80% attendance falls back to the monthly rule

given serviceYears6
given attendance80no
given perfectAttendanceMonths9
given daysTaken0
expect daysEntitled9

Case 9 — K9 days taken never push the remainder negative

given serviceYears1
given attendance80yes
given perfectAttendanceMonths0
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 South Korea 연차 유급휴가 calculator

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