Calculate accrued annual leave entitlement upon termination of employment.
Total Days in Leave Year:365
Days Employed in Leave Year:0
Pro Rata Entitlement (Accrued):0
Less: Days Already Taken:0
function calculateHoliday() {
// Inputs
var fullEntitlement = parseFloat(document.getElementById('fullEntitlement').value);
var startStr = document.getElementById('leaveYearStart').value;
var leaveStr = document.getElementById('leavingDate').value;
var daysTaken = parseFloat(document.getElementById('daysTaken').value);
var resultBox = document.getElementById('resultBox');
// Validation
if (isNaN(fullEntitlement) || !startStr || !leaveStr || isNaN(daysTaken)) {
alert("Please fill in all fields correctly.");
return;
}
var startDate = new Date(startStr);
var leaveDate = new Date(leaveStr);
// Logic to determine the end of the leave year based on the start date
// The leave year ends one day before the anniversary of the start date in the next year.
var endOfLeaveYear = new Date(startDate);
endOfLeaveYear.setFullYear(endOfLeaveYear.getFullYear() + 1);
endOfLeaveYear.setDate(endOfLeaveYear.getDate() – 1);
// Check if leaving date is valid
if (leaveDate endOfLeaveYear) {
alert("Leaving date must be within the current leave year cycle (within 12 months of start date).");
return;
}
// Calculate Total Days in the specific Leave Year (handling leap years)
var oneDay = 24 * 60 * 60 * 1000;
var totalDaysInYear = Math.round(Math.abs((endOfLeaveYear – startDate) / oneDay)) + 1;
// Calculate Days Employed
var daysEmployed = Math.round(Math.abs((leaveDate – startDate) / oneDay)) + 1;
// Calculate Accrual
// Formula: (Days Employed / Total Days in Year) * Full Entitlement
var proportion = daysEmployed / totalDaysInYear;
var accruedRaw = proportion * fullEntitlement;
// Standard rounding: usually to 1 decimal or 2. Let's use 2 for precision.
var accruedDisplay = accruedRaw.toFixed(2);
// Calculate Balance
var balance = accruedRaw – daysTaken;
var balanceDisplay = balance.toFixed(2);
// Update UI
resultBox.style.display = "block";
document.getElementById('resTotalDays').innerText = totalDaysInYear;
document.getElementById('resDaysEmployed').innerText = daysEmployed;
document.getElementById('resAccrued').innerText = accruedDisplay + " Days";
document.getElementById('resTaken').innerText = daysTaken + " Days";
var finalEl = document.getElementById('finalResult');
if (balance > 0) {
finalEl.innerHTML = "Owed to Employee: " + balanceDisplay + " Days";
finalEl.style.color = "#28a745"; // Green
} else if (balance < 0) {
// Convert negative to positive for display
finalEl.innerHTML = "Employee Owes Employer: " + Math.abs(balance).toFixed(2) + " Days";
finalEl.style.color = "#dc3545"; // Red
} else {
finalEl.innerHTML = "Balance is Zero. No days owed.";
finalEl.style.color = "#333";
}
}
How to Calculate Holiday Pay for Leavers
When an employee leaves a job part-way through their leave year, they are entitled to be paid for any holiday they have accrued but not yet taken. Conversely, if they have taken more holiday than they have accrued, the employer may be entitled to reclaim the difference from their final pay.
The Pro Rata Formula
To calculate the statutory holiday entitlement for a leaving employee, we use a pro rata calculation based on the proportion of the leave year they have worked. The standard formula used by HR professionals and payroll departments is:
(A ÷ B) × C = Accrued Entitlement
A = The number of days the employee was employed during the leave year.
B = The total number of days in the leave year (usually 365 or 366).
C = The employee's full annual holiday entitlement (e.g., 28 days).
Calculation Example
Imagine an employee with an annual entitlement of 28 days. Their leave year runs from January 1st to December 31st. They leave the company on July 1st (a non-leap year).
Days Employed: From Jan 1 to July 1 is 182 days.
Total Days in Year: 365 days.
Calculation: (182 ÷ 365) × 28 = 13.96 days.
If this employee had already taken 10 days of leave, they would be owed payment for the remaining 3.96 days. If they had taken 15 days, they would owe the employer for 1.04 days.
Key Considerations
Leap Years: Our calculator automatically detects if the leave year includes a leap day (February 29th) and adjusts the total days in the year to 366, ensuring exact accuracy.
Rounding: Statutory guidance suggests rounding up to decimal points where possible, though some contracts specify rounding to the nearest half-day. This calculator provides a precise 2-decimal figure which can be rounded according to your company handbook.
Contractual vs Statutory: Ensure you input the total contractual entitlement if it is higher than the statutory minimum (usually 5.6 weeks or 28 days in the UK).
Why Accurate Calculation Matters
Incorrectly calculating final holiday pay is a frequent cause of employment tribunal claims. Under the Working Time Regulations, workers must be paid in lieu for untaken statutory leave upon termination. Using an accurate pro rata holiday calculator ensures compliance with employment law and transparency for both the employer and the leaving employee.