diff --git a/calculations.js b/calculations.js index 7ec4438..cd662c2 100644 --- a/calculations.js +++ b/calculations.js @@ -159,15 +159,20 @@ function calculateNetWorthComparison(params) { } } + // Find age 65 index for retirement values + const age65Index = allAges.findIndex(age => age === RETIREMENT_AGE); + const retirementWith = age65Index >= 0 ? allWithProgram[age65Index] : allWithProgram[allWithProgram.length - 1]; + const retirementWithout = age65Index >= 0 ? allWithoutProgram[age65Index] : allWithoutProgram[allWithoutProgram.length - 1]; + return { ages, withProgram, withoutProgram, payoffYears, annualMatch, - totalRetirementWith: allWithProgram[allWithProgram.length - 1], - totalRetirementWithout: allWithoutProgram[allWithoutProgram.length - 1], - retirementDifference: allWithProgram[allWithProgram.length - 1] - allWithoutProgram[allWithoutProgram.length - 1], + totalRetirementWith: retirementWith, + totalRetirementWithout: retirementWithout, + retirementDifference: retirementWith - retirementWithout, // Include full yearly data if needed allAges, allWithProgram, diff --git a/index.html b/index.html index 481c4d6..9a3433c 100644 --- a/index.html +++ b/index.html @@ -180,9 +180,9 @@
Employer Match: 4%
$275,117
+$493,553
Retirement value at age 65
-$22,000 in matching over 11 years
+$20,000 in matching over 10 years
Employer Match: 5%
$424,608
+$729,134
Retirement value at age 65
-$59,500 in matching over 14 years
+$46,750 in matching over 11 years
Employer Match: 6%
$285,000
+$1,064,977
Retirement value at age 65
-$122,400 in matching over 17 years
+$93,600 in matching over 13 years
Employer Match: 3%
$58,000
+$288,373
Retirement value at age 65
-$28,350 in matching over 21 years
+$18,900 in matching over 14 years
Employer Match: 6%
$112,000
+$1,132,220
Retirement value at age 65
$34,200 in matching over 6 years
Employer Match: 4%
$95,000
+$553,921
Retirement value at age 65
-$69,000 in matching over 23 years
+$45,000 in matching over 15 years