social-security-calculator 0.0.11 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,353 @@
1
+ TN:
2
+ SF:src/constants.ts
3
+ FNF:0
4
+ FNH:0
5
+ DA:3,1
6
+ DA:4,1
7
+ DA:5,1
8
+ DA:6,1
9
+ DA:8,1
10
+ DA:9,1
11
+ DA:10,1
12
+ DA:12,1
13
+ DA:18,1
14
+ LF:9
15
+ LH:9
16
+ BRF:0
17
+ BRH:0
18
+ end_of_record
19
+ TN:
20
+ SF:src/index.ts
21
+ FN:16,calc
22
+ FN:31,(anonymous_1)
23
+ FN:32,(anonymous_2)
24
+ FN:41,calcRetirementBenefit
25
+ FN:74,calculateRetirementDates
26
+ FN:107,calculateCOLAAdjustments
27
+ FN:110,(anonymous_6)
28
+ FN:111,(anonymous_7)
29
+ FN:113,(anonymous_8)
30
+ FN:119,calculatePIA
31
+ FN:122,(anonymous_10)
32
+ FN:151,calculateAIME
33
+ FN:158,(anonymous_12)
34
+ FN:167,(anonymous_13)
35
+ FN:173,(anonymous_14)
36
+ FN:180,(anonymous_15)
37
+ FN:183,(anonymous_16)
38
+ FN:190,calculateEarlyRetirementReduction
39
+ FN:206,calculateDelayedRetirementIncrease
40
+ FN:216,getDelayedRetirementRate
41
+ FN:230,roundToFloorTenCents
42
+ FN:235,getEnglishCommonLawDate
43
+ FN:242,getFullRetirementMonths
44
+ FN:262,monthsDifference
45
+ FNF:24
46
+ FNH:24
47
+ FNDA:14,calc
48
+ FNDA:875,(anonymous_1)
49
+ FNDA:690,(anonymous_2)
50
+ FNDA:18,calcRetirementBenefit
51
+ FNDA:18,calculateRetirementDates
52
+ FNDA:18,calculateCOLAAdjustments
53
+ FNDA:1350,(anonymous_6)
54
+ FNDA:263,(anonymous_7)
55
+ FNDA:263,(anonymous_8)
56
+ FNDA:21,calculatePIA
57
+ FNDA:1245,(anonymous_10)
58
+ FNDA:17,calculateAIME
59
+ FNDA:982,(anonymous_12)
60
+ FNDA:1275,(anonymous_13)
61
+ FNDA:962,(anonymous_14)
62
+ FNDA:3757,(anonymous_15)
63
+ FNDA:563,(anonymous_16)
64
+ FNDA:6,calculateEarlyRetirementReduction
65
+ FNDA:11,calculateDelayedRetirementIncrease
66
+ FNDA:11,getDelayedRetirementRate
67
+ FNDA:284,roundToFloorTenCents
68
+ FNDA:32,getEnglishCommonLawDate
69
+ FNDA:18,getFullRetirementMonths
70
+ FNDA:18,monthsDifference
71
+ DA:18,14
72
+ DA:19,0
73
+ DA:22,14
74
+ DA:23,0
75
+ DA:26,14
76
+ DA:27,0
77
+ DA:30,14
78
+ DA:31,875
79
+ DA:32,690
80
+ DA:34,14
81
+ DA:35,14
82
+ DA:36,14
83
+ DA:38,14
84
+ DA:47,18
85
+ DA:48,18
86
+ DA:49,18
87
+ DA:52,18
88
+ DA:55,18
89
+ DA:56,18
90
+ DA:58,18
91
+ DA:59,0
92
+ DA:60,18
93
+ DA:61,6
94
+ DA:62,12
95
+ DA:63,11
96
+ DA:66,18
97
+ DA:68,18
98
+ DA:75,18
99
+ DA:76,18
100
+ DA:78,18
101
+ DA:84,18
102
+ DA:90,18
103
+ DA:96,18
104
+ DA:98,18
105
+ DA:108,18
106
+ DA:109,18
107
+ DA:110,1350
108
+ DA:111,263
109
+ DA:113,18
110
+ DA:114,263
111
+ DA:115,263
112
+ DA:120,21
113
+ DA:122,1245
114
+ DA:123,21
115
+ DA:124,0
116
+ DA:127,21
117
+ DA:130,21
118
+ DA:131,21
119
+ DA:135,21
120
+ DA:136,0
121
+ DA:137,21
122
+ DA:138,10
123
+ DA:142,11
124
+ DA:148,21
125
+ DA:152,17
126
+ DA:153,0
127
+ DA:156,17
128
+ DA:158,982
129
+ DA:159,17
130
+ DA:160,0
131
+ DA:163,17
132
+ DA:164,17
133
+ DA:167,17
134
+ DA:168,1275
135
+ DA:169,1275
136
+ DA:173,17
137
+ DA:174,962
138
+ DA:175,962
139
+ DA:179,17
140
+ DA:180,3757
141
+ DA:183,563
142
+ DA:186,17
143
+ DA:187,17
144
+ DA:191,6
145
+ DA:195,6
146
+ DA:196,5
147
+ DA:198,1
148
+ DA:203,6
149
+ DA:207,11
150
+ DA:209,11
151
+ DA:210,11
152
+ DA:212,11
153
+ DA:213,11
154
+ DA:217,11
155
+ DA:218,0
156
+ DA:222,11
157
+ DA:223,9
158
+ DA:224,7
159
+ DA:225,5
160
+ DA:226,3
161
+ DA:227,2
162
+ DA:232,284
163
+ DA:237,32
164
+ DA:238,32
165
+ DA:239,32
166
+ DA:243,18
167
+ DA:245,18
168
+ DA:246,5
169
+ DA:247,13
170
+ DA:249,4
171
+ DA:250,9
172
+ DA:251,1
173
+ DA:252,8
174
+ DA:254,3
175
+ DA:255,5
176
+ DA:256,5
177
+ DA:258,0
178
+ DA:263,18
179
+ DA:264,18
180
+ DA:265,18
181
+ LF:110
182
+ LH:100
183
+ BRDA:18,0,0,0
184
+ BRDA:18,1,0,14
185
+ BRDA:18,1,1,14
186
+ BRDA:22,2,0,0
187
+ BRDA:22,3,0,14
188
+ BRDA:22,3,1,14
189
+ BRDA:26,4,0,0
190
+ BRDA:58,5,0,0
191
+ BRDA:58,5,1,18
192
+ BRDA:60,6,0,6
193
+ BRDA:60,6,1,12
194
+ BRDA:62,7,0,11
195
+ BRDA:96,8,0,11
196
+ BRDA:96,8,1,7
197
+ BRDA:110,9,0,1350
198
+ BRDA:110,9,1,276
199
+ BRDA:120,10,0,21
200
+ BRDA:120,10,1,0
201
+ BRDA:123,11,0,0
202
+ BRDA:135,12,0,0
203
+ BRDA:135,12,1,21
204
+ BRDA:137,13,0,10
205
+ BRDA:137,13,1,11
206
+ BRDA:152,14,0,0
207
+ BRDA:152,15,0,17
208
+ BRDA:152,15,1,17
209
+ BRDA:156,16,0,17
210
+ BRDA:156,16,1,0
211
+ BRDA:159,17,0,0
212
+ BRDA:174,18,0,962
213
+ BRDA:174,18,1,76
214
+ BRDA:191,19,0,0
215
+ BRDA:195,20,0,5
216
+ BRDA:195,20,1,1
217
+ BRDA:207,21,0,0
218
+ BRDA:217,22,0,0
219
+ BRDA:222,23,0,2
220
+ BRDA:223,24,0,2
221
+ BRDA:224,25,0,2
222
+ BRDA:225,26,0,2
223
+ BRDA:226,27,0,1
224
+ BRDA:245,28,0,5
225
+ BRDA:245,28,1,13
226
+ BRDA:247,29,0,4
227
+ BRDA:247,29,1,9
228
+ BRDA:250,30,0,1
229
+ BRDA:250,30,1,8
230
+ BRDA:252,31,0,3
231
+ BRDA:252,31,1,5
232
+ BRDA:255,32,0,5
233
+ BRDA:255,32,1,0
234
+ BRF:51
235
+ BRH:37
236
+ end_of_record
237
+ TN:
238
+ SF:src/wage-index.ts
239
+ FNF:0
240
+ FNH:0
241
+ DA:4,1
242
+ DA:682,1
243
+ LF:2
244
+ LH:2
245
+ BRF:0
246
+ BRH:0
247
+ end_of_record
248
+ TN:
249
+ SF:src/estimatedEarnings/index.ts
250
+ FN:9,getEstimatedEarnings
251
+ FN:32,(anonymous_1)
252
+ FN:37,(anonymous_2)
253
+ FN:38,(anonymous_3)
254
+ FN:39,(anonymous_4)
255
+ FN:41,(anonymous_5)
256
+ FN:47,getReductionFactor
257
+ FN:51,(anonymous_7)
258
+ FN:57,(anonymous_8)
259
+ FN:57,(anonymous_9)
260
+ FNF:10
261
+ FNH:9
262
+ FNDA:14,getEstimatedEarnings
263
+ FNDA:13870,(anonymous_1)
264
+ FNDA:614,(anonymous_2)
265
+ FNDA:22805,(anonymous_3)
266
+ FNDA:14484,(anonymous_4)
267
+ FNDA:14484,(anonymous_5)
268
+ FNDA:600,getReductionFactor
269
+ FNDA:0,(anonymous_7)
270
+ FNDA:21940,(anonymous_8)
271
+ FNDA:22540,(anonymous_9)
272
+ DA:4,1
273
+ DA:5,1
274
+ DA:6,1
275
+ DA:7,1
276
+ DA:10,14
277
+ DA:11,14
278
+ DA:12,14
279
+ DA:15,14
280
+ DA:16,0
281
+ DA:18,14
282
+ DA:19,14
283
+ DA:21,14
284
+ DA:22,14
285
+ DA:23,614
286
+ DA:24,614
287
+ DA:26,614
288
+ DA:28,614
289
+ DA:32,13870
290
+ DA:37,14
291
+ DA:38,22805
292
+ DA:39,14484
293
+ DA:40,614
294
+ DA:41,14484
295
+ DA:44,14
296
+ DA:48,600
297
+ DA:49,600
298
+ DA:50,600
299
+ DA:51,600
300
+ DA:52,0
301
+ DA:54,600
302
+ DA:55,0
303
+ DA:57,22540
304
+ LF:32
305
+ LH:29
306
+ BRDA:9,0,0,4
307
+ BRDA:9,1,0,0
308
+ BRDA:12,2,0,0
309
+ BRDA:15,3,0,0
310
+ BRDA:26,4,0,14
311
+ BRDA:26,4,1,600
312
+ BRDA:30,5,0,14
313
+ BRDA:30,5,1,600
314
+ BRDA:32,6,0,0
315
+ BRDA:32,6,1,600
316
+ BRDA:32,7,0,600
317
+ BRDA:32,7,1,600
318
+ BRDA:51,8,0,0
319
+ BRDA:51,9,0,600
320
+ BRDA:51,9,1,0
321
+ BRDA:54,10,0,0
322
+ BRDA:54,10,1,600
323
+ BRF:17
324
+ BRH:10
325
+ end_of_record
326
+ TN:
327
+ SF:src/parseStatement/index.ts
328
+ FN:11,getWages
329
+ FN:20,(anonymous_1)
330
+ FNF:2
331
+ FNH:2
332
+ FNDA:3,getWages
333
+ FNDA:90,(anonymous_1)
334
+ DA:5,1
335
+ DA:8,1
336
+ DA:9,1
337
+ DA:12,3
338
+ DA:13,3
339
+ DA:14,3
340
+ DA:15,3
341
+ DA:16,0
342
+ DA:18,3
343
+ DA:20,3
344
+ DA:21,90
345
+ DA:23,3
346
+ LF:12
347
+ LH:11
348
+ BRDA:15,0,0,0
349
+ BRDA:21,1,0,3
350
+ BRDA:21,1,1,87
351
+ BRF:3
352
+ BRH:2
353
+ end_of_record
@@ -1,2 +1,2 @@
1
1
  import { Wages } from '../model';
2
- export declare function getEstimatedEarnings(age: number, lastWage: number, lastYearWorked?: number, earningGrowthRate?: number): Wages;
2
+ export declare function getEstimatedEarnings(birthDate: Date, lastWage: number, lastYearWorked?: number, earningGrowthRate?: number): Wages;
@@ -1,45 +1,53 @@
1
- import { wageIndex, quickCalcProjections, taxableMaximum } from '../wage-index';
1
+ import { wageIndex, wageIndexFuture, taxableMaximum, } from '../wage-index';
2
2
  const YOUTH_FACTOR = 8;
3
3
  const YOUTH_FACTOR_AGE = 21;
4
4
  const WORK_START_AGE = 18;
5
5
  const CURRENT_YEAR = new Date().getFullYear();
6
- export function getEstimatedEarnings(age, lastWage, lastYearWorked = CURRENT_YEAR, earningGrowthRate = 0) {
6
+ export function getEstimatedEarnings(birthDate, lastWage, lastYearWorked = CURRENT_YEAR, earningGrowthRate = 0) {
7
+ var _a;
8
+ const birthDateMinusOneDay = new Date(birthDate.getFullYear(), birthDate.getMonth(), birthDate.getDate() - 1);
9
+ const age = CURRENT_YEAR - birthDateMinusOneDay.getFullYear();
7
10
  if (age <= 22) {
8
- throw new Error('Age must be greater than 22');
11
+ // return zero
9
12
  }
10
13
  if (lastYearWorked > CURRENT_YEAR) {
11
14
  throw new Error('Last year worked cannot be in the future');
12
15
  }
13
16
  const workStartYear = CURRENT_YEAR - age + WORK_START_AGE;
14
17
  const yearTurned22 = CURRENT_YEAR - age + YOUTH_FACTOR_AGE;
15
- const wageResults = {};
18
+ const wageResults = [];
16
19
  for (let i = lastYearWorked; i >= workStartYear; i--) {
17
20
  const year = i;
18
21
  const nextYear = (i + 1);
22
+ // one-time age adjustment for youth
19
23
  const youthAdjustment = (i === yearTurned22 ? YOUTH_FACTOR : 1);
20
- wageResults[year] = (i === lastYearWorked)
21
- ? lastWage
22
- : wageResults[nextYear] * getReductionFactor(i) / (1 + earningGrowthRate) / youthAdjustment;
24
+ wageResults.push({
25
+ year,
26
+ earnings: (i === lastYearWorked)
27
+ ? lastWage
28
+ : ((_a = wageResults.find((entry) => entry.year === nextYear)) === null || _a === void 0 ? void 0 : _a.earnings) * getReductionFactor(i) / (1 + earningGrowthRate) / youthAdjustment
29
+ });
23
30
  }
24
31
  // Cap wages at taxable maximum
25
- Object.keys(wageResults).forEach(strYear => {
26
- const year = parseInt(strYear);
27
- const maxTaxable = taxableMaximum[year];
28
- wageResults[year] = Math.min(wageResults[year], maxTaxable);
32
+ wageResults.forEach(({ year, earnings }) => {
33
+ const maxTaxable = taxableMaximum.find((entry) => entry.year === year).earnings;
34
+ const currentEarnings = wageResults.find((entry) => entry.year === year).earnings;
35
+ const maxEarnings = Math.min(currentEarnings, maxTaxable);
36
+ wageResults.find((entry) => entry.year === year).earnings = maxEarnings;
29
37
  });
30
38
  return wageResults;
31
39
  }
32
40
  function getReductionFactor(year) {
33
- const allIndexes = Object.assign(Object.assign({}, wageIndex), quickCalcProjections);
41
+ const allIndexes = wageIndex.concat(wageIndexFuture);
34
42
  const lastYear = year - 1;
35
43
  const nextYear = year + 1;
36
- if (year === CURRENT_YEAR && !allIndexes[lastYear]) {
44
+ if (year === CURRENT_YEAR && !allIndexes.find((entry) => entry.year === lastYear)) {
37
45
  throw new Error(`Wage index for previous year (${lastYear}) is required`);
38
46
  }
39
47
  if (year === CURRENT_YEAR) {
40
48
  return 1;
41
49
  }
42
50
  else {
43
- return (allIndexes[year] / allIndexes[nextYear]);
51
+ return ((allIndexes.find((entry) => entry.year === year).earnings) / (allIndexes.find((entry) => entry.year === nextYear).earnings));
44
52
  }
45
53
  }
package/lib/index.d.ts CHANGED
@@ -2,15 +2,11 @@ import { Wages } from './model';
2
2
  export declare function calc(birthday: Date, retirementDate: Date, earnings: Wages): {
3
3
  AIME: number;
4
4
  NormalMonthlyBenefit: number;
5
- NormalAnnualBenefit: number;
6
- ReducedMonthlyBenefit: number;
7
- ReducedAnnualBenefit: number;
8
5
  };
9
6
  export declare function calcRetirementBenefit(birthday: Date, retirementDate: Date, AIME: number): {
10
7
  AIME: number;
11
8
  NormalMonthlyBenefit: number;
12
- NormalAnnualBenefit: number;
13
- ReducedMonthlyBenefit: number;
14
- ReducedAnnualBenefit: number;
15
9
  };
10
+ export declare function calculatePIA(AIME: number, baseYear?: number): number;
11
+ export declare function calculateAIME(earnings: Wages, baseYear?: number): number;
16
12
  export declare function getFullRetirementMonths(commonLawBirthDate: Date): number;
package/lib/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { wageIndex } from './wage-index';
2
+ const EARLY_RETIREMENT_AGE = 62;
2
3
  export function calc(birthday, retirementDate, earnings) {
3
4
  const AIME = calculateAIME(earnings);
4
5
  const results = calcRetirementBenefit(birthday, retirementDate, AIME);
@@ -6,22 +7,37 @@ export function calc(birthday, retirementDate, earnings) {
6
7
  }
7
8
  export function calcRetirementBenefit(birthday, retirementDate, AIME) {
8
9
  const eclBirthDate = getEnglishCommonLawDate(birthday);
9
- const fullRetirementMonths = getFullRetirementMonths(eclBirthDate);
10
- const PIA = calculatePIA(AIME);
11
- const benefitAt62 = calculateSocialSecurityReduction(PIA, 60);
12
- const normalMonthlyBenefit = Math.floor(PIA);
10
+ const fraMonths = getFullRetirementMonths(eclBirthDate);
11
+ const fullRetirementDate = new Date(eclBirthDate.getFullYear(), eclBirthDate.getMonth() + fraMonths, eclBirthDate.getDate());
12
+ const earliestRetirementDate = new Date(eclBirthDate.getFullYear() + EARLY_RETIREMENT_AGE, eclBirthDate.getMonth(), eclBirthDate.getDate());
13
+ const age60Year = eclBirthDate.getFullYear() + 60;
14
+ const PIA = calculatePIA(AIME, age60Year);
15
+ const earlyRetireMonths = monthsDifference(retirementDate, fullRetirementDate);
16
+ let adjustedBenefits = PIA;
17
+ if (retirementDate < earliestRetirementDate) {
18
+ adjustedBenefits = 0;
19
+ }
20
+ else if (earlyRetireMonths < 0) {
21
+ adjustedBenefits = calculateSocialSecurityReduction(PIA, earlyRetireMonths * -1);
22
+ }
23
+ else if (earlyRetireMonths > 0) {
24
+ adjustedBenefits = calculateSocialSecurityIncrease(eclBirthDate, PIA, earlyRetireMonths);
25
+ }
26
+ const monthlyBenefit = Math.floor(adjustedBenefits);
13
27
  const results = {
14
28
  "AIME": AIME,
15
- "NormalMonthlyBenefit": normalMonthlyBenefit,
16
- "NormalAnnualBenefit": PIA * 12,
17
- "ReducedMonthlyBenefit": benefitAt62,
18
- "ReducedAnnualBenefit": benefitAt62 * 12,
29
+ "NormalMonthlyBenefit": monthlyBenefit,
19
30
  };
20
31
  return results;
21
32
  }
22
- function calculatePIA(AIME) {
23
- const averageWageLastYear = Math.max(...Object.keys(wageIndex).map(val => parseInt(val)));
24
- const wageIndexLastYear = wageIndex[averageWageLastYear];
33
+ export function calculatePIA(AIME, baseYear) {
34
+ var _a;
35
+ const mostRecentWageIndex = Math.max(...wageIndex.map(val => val.year));
36
+ if (baseYear) {
37
+ baseYear = Math.min(baseYear, mostRecentWageIndex);
38
+ }
39
+ const averageWageLastYear = baseYear || mostRecentWageIndex;
40
+ const wageIndexLastYear = ((_a = wageIndex.find(val => val.year === averageWageLastYear)) === null || _a === void 0 ? void 0 : _a.earnings) || 0;
25
41
  const bendPointDivisor = 9779.44;
26
42
  const firstBendPointMultiplier = 180;
27
43
  const secondBendPointMultiplier = 1085;
@@ -48,16 +64,23 @@ function calculatePIA(AIME) {
48
64
  })();
49
65
  return PIA;
50
66
  }
51
- function calculateAIME(earnings) {
67
+ export function calculateAIME(earnings, baseYear) {
68
+ var _a;
52
69
  const lookbackYears = 35;
53
- const averageWageLastYear = Math.max(...Object.keys(wageIndex).map(val => parseInt(val)));
54
- const wageIndexLastYear = wageIndex[averageWageLastYear];
70
+ const mostRecentWageIndex = Math.max(...wageIndex.map(wag => wag.year));
71
+ if (baseYear) {
72
+ baseYear = Math.min(baseYear, mostRecentWageIndex);
73
+ }
74
+ const averageWageLastYear = baseYear || mostRecentWageIndex;
75
+ const wageIndexLastYear = ((_a = wageIndex.find(val => val.year === averageWageLastYear)) === null || _a === void 0 ? void 0 : _a.earnings) || 0;
55
76
  const futureYearsFactor = 1;
56
77
  // calculate the wage index factors
57
- const wageIndexFactors = Object.entries(wageIndex).reduce((acc, [i, val]) => ((acc[parseInt(i)] = 1 + (wageIndexLastYear - val) / val), acc), {});
58
- // adjust the earnings according to the wage index factor,
59
- // factor is 1 for any earnings record without a wage-factor
60
- const adjustedEarnings = Object.entries(earnings).reduce((acc, [i, val]) => ((acc[parseInt(i)] = val * (wageIndexFactors[parseInt(i)] || futureYearsFactor)), acc), {});
78
+ const wageIndexFactors = wageIndex.reduce((acc, { year, earnings }) => (acc[year] = 1 + (Math.max(0, wageIndexLastYear - earnings)) / earnings, acc), {});
79
+ // adjust the earnings according to the wage index factor
80
+ const adjustedEarnings = earnings.reduce((acc, { year, earnings }) => {
81
+ acc[year] = earnings * (wageIndexFactors[year] || futureYearsFactor);
82
+ return acc;
83
+ }, {});
61
84
  const top35YearsEarningsArr = Object.values(adjustedEarnings)
62
85
  .sort((a, b) => b - a) // sort the earnings from highest to lowest amount
63
86
  .slice(0, lookbackYears); // grab the highest 35 earnings years
@@ -80,6 +103,38 @@ function calculateSocialSecurityReduction(amount, months) {
80
103
  }
81
104
  return amount - amount * reduction;
82
105
  }
106
+ function calculateSocialSecurityIncrease(birthday, initialAmount, numberOfMonths) {
107
+ const birthYear = birthday.getFullYear();
108
+ let monthlyRate;
109
+ // Determine the monthly rate based on the year of birth
110
+ if (birthYear < 1933) {
111
+ throw new Error(`Invalid birth year for delayed retirement: ${birthYear}`);
112
+ }
113
+ else if (birthYear <= 1934) {
114
+ monthlyRate = 11 / 24 / 100; // 11/24 of 1%
115
+ }
116
+ else if (birthYear <= 1936) {
117
+ monthlyRate = 0.005; // 1/2 of 1%
118
+ }
119
+ else if (birthYear <= 1938) {
120
+ monthlyRate = 13 / 24 / 100; // 13/24 of 1%
121
+ }
122
+ else if (birthYear <= 1940) {
123
+ monthlyRate = 7 / 12 / 100; // 7/12 of 1%
124
+ }
125
+ else if (birthYear <= 1942) {
126
+ monthlyRate = 5 / 8 / 100; // 5/8 of 1%
127
+ }
128
+ else {
129
+ monthlyRate = 2 / 3 / 100; // 2/3 of 1%
130
+ }
131
+ // Calculate the new amount
132
+ let totalAdjustment = 0;
133
+ for (let i = 0; i < numberOfMonths; i++) {
134
+ totalAdjustment += monthlyRate;
135
+ }
136
+ return initialAmount * (1 + totalAdjustment);
137
+ }
83
138
  function roundToFloorTenCents(amount) {
84
139
  // Convert the amount to fractional dimes
85
140
  let dimes = amount * 10;
@@ -109,12 +164,10 @@ export function getFullRetirementMonths(commonLawBirthDate) {
109
164
  throw new Error('Invalid birth year');
110
165
  }
111
166
  }
112
- /*
113
- 1943-1954 66 48 $750 25.00% $350 30.00%
114
- 1955 66 and 2 months 50 $741 25.83% $345 30.83%
115
- 1956 66 and 4 months 52 $733 26.67% $341 31.67%
116
- 1957 66 and 6 months 54 $725 27.50% $337 32.50%
117
- 1958 66 and 8 months 56 $716 28.33% $333 33.33%
118
- 1959 66 and 10 months 58 $708 29.17% $329 34.17%
119
- 1960+ 67 60 $700 30.00% $325 35.00%
120
- */
167
+ function monthsDifference(date1, date2) {
168
+ // Calculate the total number of months for each date
169
+ const months1 = date1.getFullYear() * 12 + date1.getMonth();
170
+ const months2 = date2.getFullYear() * 12 + date2.getMonth();
171
+ // Return the difference in months
172
+ return months1 - months2;
173
+ }
package/lib/model.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare type YearRange = 1951 | 1952 | 1953 | 1954 | 1955 | 1956 | 1957 | 1958 | 1959 | 1960 | 1961 | 1962 | 1963 | 1964 | 1965 | 1966 | 1967 | 1968 | 1969 | 1970 | 1971 | 1972 | 1973 | 1974 | 1975 | 1976 | 1977 | 1978 | 1979 | 1980 | 1981 | 1982 | 1983 | 1984 | 1985 | 1986 | 1987 | 1988 | 1989 | 1990 | 1991 | 1992 | 1993 | 1994 | 1995 | 1996 | 1997 | 1998 | 1999 | 2000 | 2001 | 2002 | 2003 | 2004 | 2005 | 2006 | 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024;
2
- export declare type Wages = {
3
- [K in YearRange]?: number;
4
- };
1
+ export type Wages = {
2
+ year: number;
3
+ earnings: number;
4
+ }[];
@@ -13,7 +13,7 @@ async function getWages(fileName) {
13
13
  throw `${schema} is not supported (${supportedVersion})`;
14
14
  }
15
15
  const results = result[`${NS}:ONLINESOCIALSECURITYSTATEMENTDATA`][`${NS}:EARNINGSRECORD`][0][`${NS}:EARNINGS`];
16
- const earnings = results.reduce((acc, earn) => (earn[`${NS}:FICAEARNINGS`][0] === '-1' ? acc : acc[earn['$'].STARTYEAR] = parseInt(earn[`${NS}:FICAEARNINGS`][0]), acc), {});
16
+ const earnings = results.reduce((acc, earn) => (earn[`${NS}:FICAEARNINGS`][0] === '-1' ? acc : acc.push({ year: [earn['$'].STARTYEAR], earnings: parseInt(earn[`${NS}:FICAEARNINGS`][0]) }), acc), []);
17
17
  return earnings;
18
18
  }
19
19
  export default getWages;
@@ -1,32 +1,4 @@
1
1
  import { Wages } from './model';
2
2
  export declare const wageIndex: Wages;
3
- export declare const quickCalcProjections: {
4
- 2023: number;
5
- 2024: number;
6
- 2025: number;
7
- 2026: number;
8
- 2027: number;
9
- 2028: number;
10
- 2029: number;
11
- 2030: number;
12
- 2031: number;
13
- 2032: number;
14
- 2033: number;
15
- 2034: number;
16
- 2035: number;
17
- 2036: number;
18
- 2037: number;
19
- 2038: number;
20
- 2039: number;
21
- 2040: number;
22
- 2041: number;
23
- 2042: number;
24
- 2043: number;
25
- 2044: number;
26
- 2045: number;
27
- 2046: number;
28
- 2047: number;
29
- 2048: number;
30
- 2049: number;
31
- };
3
+ export declare const wageIndexFuture: Wages;
32
4
  export declare const taxableMaximum: Wages;