@getexeer/saudi-eosb
v1.0.1
Published
Saudi end-of-service benefits under Articles 84 and 85 of the Saudi Labour Law: base award, resignation fractions and length of service. Zero dependencies, works in Node and the browser.
Downloads
326
Maintainers
Readme
saudi-eosb
End-of-service benefits for Saudi Arabia — مكافأة نهاية الخدمة — under Articles 84 and 85 of the Saudi Labour Law.
Zero dependencies. No build step. Runs in Node 18+ and in the browser.
import { calculateEosb, REASON } from "@getexeer/saudi-eosb";
calculateEosb({ wage: 5000, years: 7, reason: REASON.RESIGNATION }).amount;
// 15000What it implements
Article 84 — the base award. Half a month's wage for each of the first five years of service, and one full month's wage for each year after that, calculated on the last wage.
Article 85 — what resignation actually pays. The base award is reduced on resignation:
| Length of service | Entitlement | | --- | --- | | Under 2 years | None | | 2 to under 5 years | One third of the base award | | 5 to under 10 years | Two thirds of the base award | | 10 years or more | The full base award |
Termination by the employer pays the full base award.
Install
npm install @getexeer/saudi-eosbUsage
From a length of service you already have
import { calculateEosb, REASON } from "@getexeer/saudi-eosb";
const result = calculateEosb({
wage: 9000, // last monthly wage, in SAR
years: 6.5, // decimal years of service
reason: REASON.TERMINATION, // or REASON.RESIGNATION
});
result.amount; // 58500 — the settlement
result.baseAmount; // 58500 — Article 84 award before the Article 85 fraction
result.baseMonths; // 6.5 — months of wage
result.factor; // 1From two dates
const result = calculateEosb({
wage: 7500,
startDate: "2018-03-01",
endDate: "2026-09-01",
reason: REASON.RESIGNATION,
});
result.years; // 8.50… decimal years used in the calculation
result.service.wholeYears; // 8
result.service.months; // 6
result.service.days; // 0
result.amount; // two thirds of the base awardThe pieces on their own
import { baseAward, resignationFactor, serviceLength } from "@getexeer/saudi-eosb";
baseAward({ wage: 5000, years: 10 });
// { firstYears: 5, laterYears: 5, baseMonths: 7.5, amount: 37500 }
resignationFactor(7);
// { factor: 0.666…, label: "Two thirds (5 to under 10 years)", labelAr: "ثلثا المكافأة (5 إلى أقل من 10)" }
serviceLength("2020-01-01", "2023-07-01");
// { totalDays: 1277, years: 3.49…, wholeYears: 3, months: 5, days: 27 }What this library does not decide
These turn on facts and written procedures rather than arithmetic, so they are left to a human to review. They are named here so nobody assumes the function has already handled them:
- Dismissal for a valid reason under Article 80 — no award is due, and the employer must have followed the investigation procedure the article requires.
- Leaving for a lawful reason under Article 81.
- The full-award cases under Article 87 — for example a woman resigning within six months of marriage or three months of childbirth.
Accuracy notes
- Service length is counted at 365.25 days per year, so leap years do not drift the total.
- Amounts are rounded to two decimals.
- Article 84 names the last wage as the basis, so pass the final monthly wage, not an average.
- The library throws on a negative wage, a negative length of service, an unparseable date, or an unknown reason. It does not return
NaNquietly.
TypeScript
Types ship with the package. calculateEosb returns a frozen EosbResult; REASON is a frozen const object, so reason is narrowed rather than a bare string.
Not legal advice
This is an arithmetic library. It encodes a reading of Articles 84 and 85 and nothing more. Verify any figure that will actually be paid, and consult a qualified professional on contested cases. Applicable rules and their interpretation can change.
About
This is the calculation behind the free end-of-service calculator published by Exeer (إكسير), a Saudi administrative and HR system. It is packaged here so that anyone building payroll or HR software for Saudi businesses can reuse the same rules instead of re-deriving them.
- Try the calculator: getexeer.com/tools/eosb.html
- Exeer, the system it belongs to: getexeer.com
- Machine-readable summary for AI assistants: getexeer.com/llms.txt
License
MIT © Exeer
