How the Japan 年次有給休暇 calculator is verified

Inputs

InputFieldType
Months of continuous serviceserviceMonthsnumber
Attendance as a % of all working daysattendanceRatenumber
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)
Qualifiesqualifies($n(serviceMonths) >= $const.qualifyingMonths and $n(attendanceRate) >= $const.attendancePercent)
Years After QualifyingyearsAfterQualifying($y := $floor(($n(serviceMonths) - $const.qualifyingMonths) / 12); $y < 0 ? 0 : $y)
Added DaysaddedDays(yearsAfterQualifying >= $const.bandYear6 ? $const.addAfter6Years : (yearsAfterQualifying = $const.bandYear5 ? $const.addAfter5Years : (yearsAfterQualifying = $const.bandYear4 ? $const.addAfter4Years : (yearsAfterQualifying = $const.bandYear3 ? $const.addAfter3Years : (yearsAfterQualifying = $const.bandYear2 ? $const.addAfter2Years : (yearsAfterQualifying = $const.bandYear1 ? $const.addAfter1Year : 0))))))
Days EntitleddaysEntitled(qualifies = true ? $const.baseDays + addedDays : 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
baseDays10
qualifyingMonths6
attendancePercent80
bandYear11
addAfter1Year1
bandYear22
addAfter2Years2
bandYear33
addAfter3Years4
bandYear44
addAfter4Years6
bandYear55
addAfter5Years8
bandYear66
addAfter6Years10

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 under six months there is no entitlement at all

given serviceMonths5
given attendanceRate100
given daysTaken0
expect qualifiesfalse
expect daysEntitled0

Case 2 — K2 at six months exactly, art. 39(1)'s ten working days

given serviceMonths6
given attendanceRate100
given daysTaken0
expect qualifiestrue
expect yearsAfterQualifying0
expect daysEntitled10

Case 3 — K3 one year past the six-month mark adds one day

given serviceMonths18
given attendanceRate100
given daysTaken0
expect yearsAfterQualifying1
expect addedDays1
expect daysEntitled11

Case 4 — K4 the table is not linear: three years past adds four days, not three

given serviceMonths42
given attendanceRate100
given daysTaken0
expect yearsAfterQualifying3
expect addedDays4
expect daysEntitled14

Case 5 — K5 six years past the mark is the statutory ceiling of twenty

given serviceMonths78
given attendanceRate100
given daysTaken0
expect yearsAfterQualifying6
expect addedDays10
expect daysEntitled20

Case 6 — K6 and it plateaus: thirty years' service is still twenty days

given serviceMonths360
given attendanceRate100
given daysTaken0
expect daysEntitled20

Case 7 — K7 the 80% attendance test is a gate, not a reduction: 79% is nothing

given serviceMonths78
given attendanceRate79
given daysTaken0
expect qualifiesfalse
expect daysEntitled0

Case 8 — K8 and 80% exactly qualifies in full — the statute says 八割以上, eight tenths or more

given serviceMonths78
given attendanceRate80
given daysTaken0
expect qualifiestrue
expect daysEntitled20

Case 9 — K9 days already taken come off the remainder, and it never goes negative

given serviceMonths78
given attendanceRate100
given daysTaken25
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 Japan 年次有給休暇 calculator

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