@casomoltd/nhs-pay 0.19.4 → 0.21.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.
- package/README.md +95 -18
- package/dist/afc-scales.d.ts +14 -7
- package/dist/afc-scales.js +19 -19
- package/dist/afc-scales.js.map +1 -1
- package/dist/bands.d.ts +2 -2
- package/dist/commutation.d.ts +49 -5
- package/dist/commutation.js +124 -43
- package/dist/commutation.js.map +1 -1
- package/dist/dates.d.ts +2 -0
- package/dist/dates.js +4 -0
- package/dist/dates.js.map +1 -1
- package/dist/errors.d.ts +70 -12
- package/dist/errors.js +85 -19
- package/dist/errors.js.map +1 -1
- package/dist/factor-basis.d.ts +87 -0
- package/dist/factor-basis.js +99 -0
- package/dist/factor-basis.js.map +1 -0
- package/dist/gad/erf-1-401-2023-06-30.d.ts +47 -0
- package/dist/gad/erf-1-401-2023-06-30.js +73 -0
- package/dist/gad/erf-1-401-2023-06-30.js.map +1 -0
- package/dist/gad/erf-1-402-2023-06-30.d.ts +48 -0
- package/dist/gad/erf-1-402-2023-06-30.js +84 -0
- package/dist/gad/erf-1-402-2023-06-30.js.map +1 -0
- package/dist/gad/erf-1-407-2023-06-30.d.ts +47 -0
- package/dist/gad/erf-1-407-2023-06-30.js +73 -0
- package/dist/gad/erf-1-407-2023-06-30.js.map +1 -0
- package/dist/gad/erf-2023-06-30.d.ts +3 -0
- package/dist/gad/erf-2023-06-30.js +1 -0
- package/dist/gad/erf-2023-06-30.js.map +1 -1
- package/dist/gad/factor-table.d.ts +62 -31
- package/dist/gad/factor-table.js +67 -34
- package/dist/gad/factor-table.js.map +1 -1
- package/dist/gad/lrf-2-416-2023-06-30.d.ts +46 -0
- package/dist/gad/lrf-2-416-2023-06-30.js +72 -0
- package/dist/gad/lrf-2-416-2023-06-30.js.map +1 -0
- package/dist/gad/lrf-2023-06-30.d.ts +3 -0
- package/dist/gad/lrf-2023-06-30.js +1 -0
- package/dist/gad/lrf-2023-06-30.js.map +1 -1
- package/dist/gad/promotional-scale-2020.d.ts +37 -0
- package/dist/gad/promotional-scale-2020.js +38 -0
- package/dist/gad/promotional-scale-2020.js.map +1 -0
- package/dist/index.d.ts +17 -4
- package/dist/index.js +22 -13
- package/dist/index.js.map +1 -1
- package/dist/iso-date.d.ts +7 -0
- package/dist/iso-date.js +11 -0
- package/dist/iso-date.js.map +1 -1
- package/dist/member-benefits.d.ts +237 -0
- package/dist/member-benefits.js +440 -0
- package/dist/member-benefits.js.map +1 -0
- package/dist/pay-path.d.ts +70 -0
- package/dist/pay-path.js +155 -0
- package/dist/pay-path.js.map +1 -0
- package/dist/pension/curve.d.ts +74 -0
- package/dist/pension/curve.js +134 -0
- package/dist/pension/curve.js.map +1 -0
- package/dist/pension/history.js +3 -3
- package/dist/pension/history.js.map +1 -1
- package/dist/pension/ledger.d.ts +71 -31
- package/dist/pension/ledger.js +41 -6
- package/dist/pension/ledger.js.map +1 -1
- package/dist/pension/money.d.ts +23 -6
- package/dist/pension/money.js +23 -1
- package/dist/pension/money.js.map +1 -1
- package/dist/pension/uplift.d.ts +23 -0
- package/dist/pension/uplift.js +34 -1
- package/dist/pension/uplift.js.map +1 -1
- package/dist/pension-projection.d.ts +54 -52
- package/dist/pension-projection.js +65 -219
- package/dist/pension-projection.js.map +1 -1
- package/dist/scale-point.d.ts +11 -1
- package/dist/scales.d.ts +9 -9
- package/dist/scales.js +68 -67
- package/dist/scales.js.map +1 -1
- package/dist/sections/final-salary.d.ts +97 -0
- package/dist/sections/final-salary.js +99 -0
- package/dist/sections/final-salary.js.map +1 -0
- package/dist/sections/section-1995.d.ts +20 -0
- package/dist/sections/section-1995.js +52 -0
- package/dist/sections/section-1995.js.map +1 -0
- package/dist/sections/section-2008.d.ts +16 -0
- package/dist/sections/section-2008.js +44 -0
- package/dist/sections/section-2008.js.map +1 -0
- package/dist/sections/section-2015.d.ts +43 -0
- package/dist/sections/section-2015.js +57 -0
- package/dist/sections/section-2015.js.map +1 -0
- package/dist/values.d.ts +4 -5
- package/dist/values.js +4 -5
- package/dist/values.js.map +1 -1
- package/package.json +9 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member-benefits.js","sourceRoot":"","sources":["../src/member-benefits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAC,MAAM,EAAE,oBAAoB,EAAC,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EAAC,kBAAkB,EAAE,SAAS,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AAGxE,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAC,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,UAAU,EAAE,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAAC,UAAU,EAAC,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAC,UAAU,EAAC,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AAEnC,uDAAuD;AAEvD;;;;GAIG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C;AACJ,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { IsoDate } from './iso-date.js';
|
|
2
|
+
import type { SteppedPoint } from './scale-point.js';
|
|
3
|
+
/**
|
|
4
|
+
* GAD's promotional pay index at an age: growth from promotion and
|
|
5
|
+
* progression over and above general pay awards, 100 at age 25,
|
|
6
|
+
* linear between the published five-year rows and flat beyond their
|
|
7
|
+
* ends.
|
|
8
|
+
*
|
|
9
|
+
* **The two non-manual columns, averaged.** GAD splits the index by
|
|
10
|
+
* sex and we do not ask a member's sex, nor infer it: averaging is
|
|
11
|
+
* the only version that encodes no guess about the member. It
|
|
12
|
+
* overstates progression for women and understates it for men, which a
|
|
13
|
+
* caller showing its figures should disclose. Non-manual is not a second
|
|
14
|
+
* assumption — every Agenda for Change band is non-manual in GAD's
|
|
15
|
+
* terms.
|
|
16
|
+
*/
|
|
17
|
+
export declare function promotionalIndex(age: number): number;
|
|
18
|
+
/**
|
|
19
|
+
* A year's pensionable pay the member gave us, in today's money, which
|
|
20
|
+
* the field's name says so a caller cannot pass a payslip's cash
|
|
21
|
+
* figure by mistake: every other year of the path is in today's money,
|
|
22
|
+
* and one cash figure among them would be silently low. Bringing an
|
|
23
|
+
* old figure forward is deferred:
|
|
24
|
+
* https://github.com/casomoltd/nhs-pay/issues/22
|
|
25
|
+
*/
|
|
26
|
+
export interface DeclaredPay {
|
|
27
|
+
readonly schemeYearEnd: number;
|
|
28
|
+
readonly todaysMoney: number;
|
|
29
|
+
}
|
|
30
|
+
/** What a member told us about their pay. */
|
|
31
|
+
export interface MemberPay {
|
|
32
|
+
readonly declared: readonly DeclaredPay[];
|
|
33
|
+
/** Pensionable pay now, in today's money. The anchor every
|
|
34
|
+
* worked-out year scales from, so it is the one figure the path
|
|
35
|
+
* cannot do without. */
|
|
36
|
+
readonly current: {
|
|
37
|
+
readonly todaysMoney: number;
|
|
38
|
+
readonly asAt: IsoDate;
|
|
39
|
+
};
|
|
40
|
+
/** The member's pay scale and where on it they are, while steps
|
|
41
|
+
* remain. Null off a stepped scale, or at its top. `current` is one
|
|
42
|
+
* of `points`, the object itself, so it cannot name a point the
|
|
43
|
+
* scale does not have. */
|
|
44
|
+
readonly ladder: {
|
|
45
|
+
readonly points: readonly SteppedPoint[];
|
|
46
|
+
readonly current: SteppedPoint;
|
|
47
|
+
} | null;
|
|
48
|
+
}
|
|
49
|
+
/** What a year's pay rests on: see the module header. */
|
|
50
|
+
export declare const PAY_BASES: {
|
|
51
|
+
readonly declared: "declared";
|
|
52
|
+
readonly contractual: "contractual";
|
|
53
|
+
readonly projected: "projected";
|
|
54
|
+
readonly reconstructed: "reconstructed";
|
|
55
|
+
};
|
|
56
|
+
export type PayBasis = (typeof PAY_BASES)[keyof typeof PAY_BASES];
|
|
57
|
+
export interface YearPay {
|
|
58
|
+
readonly pay: number;
|
|
59
|
+
readonly basis: PayBasis;
|
|
60
|
+
}
|
|
61
|
+
/** A member's pensionable pay, every scheme year, in today's money. */
|
|
62
|
+
export interface PayPath {
|
|
63
|
+
payFor(schemeYearEnd: number): YearPay;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Build a member's pay path. Refuses only where there is nothing to
|
|
67
|
+
* build from: every other gap is filled, the same way for everybody,
|
|
68
|
+
* and labelled as filled.
|
|
69
|
+
*/
|
|
70
|
+
export declare function buildPayPath(dateOfBirth: IsoDate, pay: MemberPay): PayPath;
|
package/dist/pay-path.js
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A member's pensionable pay in every scheme year of their career,
|
|
3
|
+
* in today's money, and why each year's figure is what it is.
|
|
4
|
+
*
|
|
5
|
+
* Every section reads pay: the 2015 Section banks a slice of each
|
|
6
|
+
* year's, and a final-salary section measures its last window. So pay
|
|
7
|
+
* is built once per member and every section reads the same path,
|
|
8
|
+
* which is what makes final pay identical under both remedy elections
|
|
9
|
+
* by construction rather than by care.
|
|
10
|
+
*
|
|
11
|
+
* A member rarely declares more than today's pay, so the rest is
|
|
12
|
+
* worked out, the same way for everybody, and each year says which
|
|
13
|
+
* of four things it is:
|
|
14
|
+
*
|
|
15
|
+
* - **declared** — the member told us: their current pay, and any
|
|
16
|
+
* year they gave a figure for.
|
|
17
|
+
* - **contractual** — owed under their pay scale: the steps still to
|
|
18
|
+
* come on an Agenda for Change band, which progression pays on
|
|
19
|
+
* service rather than on promotion.
|
|
20
|
+
* - **projected** — after the last contractual step, on GAD's
|
|
21
|
+
* promotional curve from the pay at that step.
|
|
22
|
+
* - **reconstructed** — before today, on the same curve run
|
|
23
|
+
* backwards from today's pay.
|
|
24
|
+
*
|
|
25
|
+
* One curve in both directions, because reconstructing an unknown
|
|
26
|
+
* past and projecting an unknown future are the same problem and the
|
|
27
|
+
* same published research answers both.
|
|
28
|
+
*/
|
|
29
|
+
import { PROMOTIONAL_SCALE_2020 } from './gad/promotional-scale-2020.js';
|
|
30
|
+
import { invariant, PayPathUnavailable } from './errors.js';
|
|
31
|
+
import { isoToDate } from './iso-date.js';
|
|
32
|
+
import { schemeYearEndFor } from './pension/seed.js';
|
|
33
|
+
/**
|
|
34
|
+
* GAD's promotional pay index at an age: growth from promotion and
|
|
35
|
+
* progression over and above general pay awards, 100 at age 25,
|
|
36
|
+
* linear between the published five-year rows and flat beyond their
|
|
37
|
+
* ends.
|
|
38
|
+
*
|
|
39
|
+
* **The two non-manual columns, averaged.** GAD splits the index by
|
|
40
|
+
* sex and we do not ask a member's sex, nor infer it: averaging is
|
|
41
|
+
* the only version that encodes no guess about the member. It
|
|
42
|
+
* overstates progression for women and understates it for men, which a
|
|
43
|
+
* caller showing its figures should disclose. Non-manual is not a second
|
|
44
|
+
* assumption — every Agenda for Change band is non-manual in GAD's
|
|
45
|
+
* terms.
|
|
46
|
+
*/
|
|
47
|
+
export function promotionalIndex(age) {
|
|
48
|
+
invariant(Number.isFinite(age), `promotionalIndex: age ${age}`);
|
|
49
|
+
const { ages, nonManual } = PROMOTIONAL_SCALE_2020;
|
|
50
|
+
const blend = (i) => (nonManual.male[i] + nonManual.female[i]) / 2;
|
|
51
|
+
const last = ages.length - 1;
|
|
52
|
+
if (age <= ages[0])
|
|
53
|
+
return blend(0);
|
|
54
|
+
if (age >= ages[last])
|
|
55
|
+
return blend(last);
|
|
56
|
+
const hi = ages.findIndex((a) => a > age);
|
|
57
|
+
const lo = hi - 1;
|
|
58
|
+
const through = (age - ages[lo]) / (ages[hi] - ages[lo]);
|
|
59
|
+
return blend(lo) + (blend(hi) - blend(lo)) * through;
|
|
60
|
+
}
|
|
61
|
+
/** What a year's pay rests on: see the module header. */
|
|
62
|
+
export const PAY_BASES = {
|
|
63
|
+
declared: 'declared',
|
|
64
|
+
contractual: 'contractual',
|
|
65
|
+
projected: 'projected',
|
|
66
|
+
reconstructed: 'reconstructed',
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* The contractual steps still to come, as the scheme years each is
|
|
70
|
+
* first paid in, scaled to the member's own pay so a part-time
|
|
71
|
+
* member's steps stay in proportion to what they are actually paid.
|
|
72
|
+
*/
|
|
73
|
+
function contractualSteps(ladder, current, currentYear) {
|
|
74
|
+
const here = ladder.current;
|
|
75
|
+
if (!ladder.points.includes(here)) {
|
|
76
|
+
throw new RangeError(`pay ladder: current point "${here.label}" is not one of its points`);
|
|
77
|
+
}
|
|
78
|
+
const hereYears = here.yearsExperience;
|
|
79
|
+
const scale = current.todaysMoney / here.salary;
|
|
80
|
+
return ladder.points
|
|
81
|
+
.filter((p) => p.yearsExperience > hereYears)
|
|
82
|
+
.map((p) => ({
|
|
83
|
+
from: currentYear + p.yearsExperience - hereYears,
|
|
84
|
+
pay: p.salary * scale,
|
|
85
|
+
}))
|
|
86
|
+
.sort((a, b) => a.from - b.from);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Build a member's pay path. Refuses only where there is nothing to
|
|
90
|
+
* build from: every other gap is filled, the same way for everybody,
|
|
91
|
+
* and labelled as filled.
|
|
92
|
+
*/
|
|
93
|
+
export function buildPayPath(dateOfBirth, pay) {
|
|
94
|
+
const { current } = pay;
|
|
95
|
+
// Nought is a figure: a member paid nothing accrues nothing, and a
|
|
96
|
+
// stated balance still revalues. Only what is not a figure refuses.
|
|
97
|
+
if (!Number.isFinite(current.todaysMoney) || current.todaysMoney < 0) {
|
|
98
|
+
throw new PayPathUnavailable(`current pay ${current.todaysMoney} is not a pay figure`);
|
|
99
|
+
}
|
|
100
|
+
const born = isoToDate(dateOfBirth);
|
|
101
|
+
/** The age whose birthday falls in a scheme year: the years since
|
|
102
|
+
* the scheme year the member was born in. */
|
|
103
|
+
const bornIn = schemeYearEndFor(born);
|
|
104
|
+
const ageIn = (schemeYearEnd) => schemeYearEnd - bornIn;
|
|
105
|
+
const indexIn = (schemeYearEnd) => promotionalIndex(ageIn(schemeYearEnd));
|
|
106
|
+
const currentYear = schemeYearEndFor(isoToDate(current.asAt));
|
|
107
|
+
const declared = new Map();
|
|
108
|
+
for (const { schemeYearEnd, todaysMoney: figure } of pay.declared) {
|
|
109
|
+
if (declared.has(schemeYearEnd)) {
|
|
110
|
+
throw new RangeError(`pay path: ${schemeYearEnd} declared twice`);
|
|
111
|
+
}
|
|
112
|
+
if (!Number.isFinite(figure) || figure <= 0) {
|
|
113
|
+
throw new RangeError(`pay path: ${schemeYearEnd} declared as ${figure}`);
|
|
114
|
+
}
|
|
115
|
+
declared.set(schemeYearEnd, figure);
|
|
116
|
+
}
|
|
117
|
+
const steps = pay.ladder === null
|
|
118
|
+
? []
|
|
119
|
+
: contractualSteps(pay.ladder, current, currentYear);
|
|
120
|
+
const lastStep = steps.at(-1);
|
|
121
|
+
/** Where the curve takes over going forwards: the top of the
|
|
122
|
+
* ladder, or today where there is no ladder left to climb. */
|
|
123
|
+
const curveFrom = lastStep ?? { from: currentYear, pay: current.todaysMoney };
|
|
124
|
+
return {
|
|
125
|
+
payFor(schemeYearEnd) {
|
|
126
|
+
invariant(Number.isInteger(schemeYearEnd), `pay path: scheme year ${schemeYearEnd}`);
|
|
127
|
+
const given = declared.get(schemeYearEnd);
|
|
128
|
+
if (given !== undefined)
|
|
129
|
+
return { pay: given, basis: PAY_BASES.declared };
|
|
130
|
+
if (schemeYearEnd === currentYear) {
|
|
131
|
+
return { pay: current.todaysMoney, basis: PAY_BASES.declared };
|
|
132
|
+
}
|
|
133
|
+
if (schemeYearEnd < currentYear) {
|
|
134
|
+
return {
|
|
135
|
+
pay: current.todaysMoney * indexIn(schemeYearEnd)
|
|
136
|
+
/ indexIn(currentYear),
|
|
137
|
+
basis: PAY_BASES.reconstructed,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
if (schemeYearEnd <= curveFrom.from) {
|
|
141
|
+
const paid = steps.filter((s) => s.from <= schemeYearEnd);
|
|
142
|
+
return {
|
|
143
|
+
pay: paid.at(-1)?.pay ?? current.todaysMoney,
|
|
144
|
+
basis: PAY_BASES.contractual,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
return {
|
|
148
|
+
pay: curveFrom.pay * indexIn(schemeYearEnd)
|
|
149
|
+
/ indexIn(curveFrom.from),
|
|
150
|
+
basis: PAY_BASES.projected,
|
|
151
|
+
};
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=pay-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pay-path.js","sourceRoot":"","sources":["../src/pay-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAC,sBAAsB,EAAC,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAC,SAAS,EAAE,kBAAkB,EAAC,MAAM,aAAa,CAAC;AAE1D,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AAGnD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,S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import type { EstimatedHistory } from './history.js';
|
|
2
|
+
import type { MemberLedger } from './ledger.js';
|
|
3
|
+
import type { MemberPhase } from './uplift.js';
|
|
4
|
+
/** A point on the projection curve */
|
|
5
|
+
export interface ProjectionPoint {
|
|
6
|
+
/** Age in years (can be fractional) */
|
|
7
|
+
age: number;
|
|
8
|
+
/** Annual pension in actual £ of that year. Below today's
|
|
9
|
+
* age this is SMALLER than `real`: past pounds bought more. */
|
|
10
|
+
nominal: number;
|
|
11
|
+
/** Annual pension in today's £ — what the projection
|
|
12
|
+
* computes; `nominal` is this scaled by CPI. */
|
|
13
|
+
real: number;
|
|
14
|
+
/** Whether this is accrued (known) or projected — i.e.
|
|
15
|
+
* whether the point falls on or before today. Deliberately
|
|
16
|
+
* NOT `phase === 'active'`: a consumer uses this to separate
|
|
17
|
+
* history from forecast, and a future working year is
|
|
18
|
+
* forecast. */
|
|
19
|
+
accrued: boolean;
|
|
20
|
+
/** Which lifecycle phase the point falls in. */
|
|
21
|
+
phase: MemberPhase;
|
|
22
|
+
}
|
|
23
|
+
/** What drawing the curve needs of one walk: its ledger, its dates,
|
|
24
|
+
* and where it starts. */
|
|
25
|
+
interface CurveRun {
|
|
26
|
+
readonly today: Date;
|
|
27
|
+
readonly dateOfBirth: Date;
|
|
28
|
+
readonly exitDate: Date;
|
|
29
|
+
readonly retirementDate: Date;
|
|
30
|
+
readonly npa: number;
|
|
31
|
+
readonly ledger: MemberLedger;
|
|
32
|
+
readonly history: EstimatedHistory | null;
|
|
33
|
+
readonly curveFrom: Date;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The last scheme year a walk reaches: six past the later of the
|
|
37
|
+
* drawing and the pension age. The curve draws five years of age
|
|
38
|
+
* beyond that point, and a birthday can fall in the scheme year after
|
|
39
|
+
* the one the age is counted from, so five years of age can span six
|
|
40
|
+
* scheme years.
|
|
41
|
+
*/
|
|
42
|
+
export declare function walkThrough(drawing: Date, pensionAge: Date): number;
|
|
43
|
+
/**
|
|
44
|
+
* The curve is the ledger's own steps, plotted ON THEM.
|
|
45
|
+
*
|
|
46
|
+
* **One point per scheme year, at its 31 March close** — the
|
|
47
|
+
* date an Annual Benefit Statement is drawn to, so every
|
|
48
|
+
* plotted value is a figure a member can lay beside paper.
|
|
49
|
+
*
|
|
50
|
+
* **Never at BIRTHDAYS**, which is the plotting the age axis
|
|
51
|
+
* invites. A birthday falls somewhere inside a scheme year:
|
|
52
|
+
* after the April uplift but before the year's slice lands, or
|
|
53
|
+
* the other way about. So a member born in January reads their
|
|
54
|
+
* 43rd-birthday point as "the 2026 figure" and gets a balance
|
|
55
|
+
* with neither the year's accrual in it nor any relation to a
|
|
56
|
+
* year end — values right for their dates and wrong for every
|
|
57
|
+
* question anyone asks of them, which surfaces as "the chart
|
|
58
|
+
* disagrees with my statement".
|
|
59
|
+
*
|
|
60
|
+
* The x-axis stays an AGE, because that is how people think
|
|
61
|
+
* about retiring. Age N is plotted at the close of the scheme
|
|
62
|
+
* year N's birthday falls in — the year that birthday belongs
|
|
63
|
+
* to — so the axis is unchanged and only the dates behind it
|
|
64
|
+
* move onto the scheme's own calendar.
|
|
65
|
+
*
|
|
66
|
+
* Nothing is drawn before the ledger's own start. For a
|
|
67
|
+
* statement that is the statement's date, and the reason is
|
|
68
|
+
* not tidiness: a member enters one figure, not their history,
|
|
69
|
+
* so anything earlier would be that figure run BACKWARDS
|
|
70
|
+
* through rates nobody checked. An inverse calculation drawn
|
|
71
|
+
* as history is a claim the tool cannot support.
|
|
72
|
+
*/
|
|
73
|
+
export declare function buildCurve(cash: CurveRun, todays: CurveRun): ProjectionPoint[];
|
|
74
|
+
export {};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The 2015 Section's balance drawn as a curve: one point per scheme
|
|
3
|
+
* year, on both rulers, from where the ledger starts to five years of
|
|
4
|
+
* age past the later of the drawing and the pension age.
|
|
5
|
+
*
|
|
6
|
+
* Shared by `projectPension` and `memberBenefits`, which each walk
|
|
7
|
+
* the same ledger and plot it the same way, so it belongs to neither.
|
|
8
|
+
*/
|
|
9
|
+
import { yearsBetween } from '../dates.js';
|
|
10
|
+
import { schemeYearEndDate, schemeYearEndFor } from './seed.js';
|
|
11
|
+
import { phaseAt } from './uplift.js';
|
|
12
|
+
/**
|
|
13
|
+
* The last scheme year a walk reaches: six past the later of the
|
|
14
|
+
* drawing and the pension age. The curve draws five years of age
|
|
15
|
+
* beyond that point, and a birthday can fall in the scheme year after
|
|
16
|
+
* the one the age is counted from, so five years of age can span six
|
|
17
|
+
* scheme years.
|
|
18
|
+
*/
|
|
19
|
+
export function walkThrough(drawing, pensionAge) {
|
|
20
|
+
return Math.max(schemeYearEndFor(drawing), schemeYearEndFor(pensionAge)) + 6;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A member's age on a date, as WHOLE YEARS plus the fraction of
|
|
24
|
+
* the year since their birthday.
|
|
25
|
+
*
|
|
26
|
+
* The whole part is calendar arithmetic, so it is the age they
|
|
27
|
+
* would give if asked. The fraction only orders points within a
|
|
28
|
+
* year, which is all the chart needs it for.
|
|
29
|
+
*/
|
|
30
|
+
function ageAtYearEnd(dateOfBirth, on) {
|
|
31
|
+
const birthdayIn = (year) => new Date(year, dateOfBirth.getMonth(), dateOfBirth.getDate());
|
|
32
|
+
const thisYear = birthdayIn(on.getFullYear());
|
|
33
|
+
const reached = thisYear <= on;
|
|
34
|
+
const whole = on.getFullYear() - dateOfBirth.getFullYear()
|
|
35
|
+
- (reached ? 0 : 1);
|
|
36
|
+
const last = reached ? thisYear : birthdayIn(on.getFullYear() - 1);
|
|
37
|
+
const next = reached ? birthdayIn(on.getFullYear() + 1) : thisYear;
|
|
38
|
+
return whole
|
|
39
|
+
+ (on.getTime() - last.getTime())
|
|
40
|
+
/ (next.getTime() - last.getTime());
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The curve is the ledger's own steps, plotted ON THEM.
|
|
44
|
+
*
|
|
45
|
+
* **One point per scheme year, at its 31 March close** — the
|
|
46
|
+
* date an Annual Benefit Statement is drawn to, so every
|
|
47
|
+
* plotted value is a figure a member can lay beside paper.
|
|
48
|
+
*
|
|
49
|
+
* **Never at BIRTHDAYS**, which is the plotting the age axis
|
|
50
|
+
* invites. A birthday falls somewhere inside a scheme year:
|
|
51
|
+
* after the April uplift but before the year's slice lands, or
|
|
52
|
+
* the other way about. So a member born in January reads their
|
|
53
|
+
* 43rd-birthday point as "the 2026 figure" and gets a balance
|
|
54
|
+
* with neither the year's accrual in it nor any relation to a
|
|
55
|
+
* year end — values right for their dates and wrong for every
|
|
56
|
+
* question anyone asks of them, which surfaces as "the chart
|
|
57
|
+
* disagrees with my statement".
|
|
58
|
+
*
|
|
59
|
+
* The x-axis stays an AGE, because that is how people think
|
|
60
|
+
* about retiring. Age N is plotted at the close of the scheme
|
|
61
|
+
* year N's birthday falls in — the year that birthday belongs
|
|
62
|
+
* to — so the axis is unchanged and only the dates behind it
|
|
63
|
+
* move onto the scheme's own calendar.
|
|
64
|
+
*
|
|
65
|
+
* Nothing is drawn before the ledger's own start. For a
|
|
66
|
+
* statement that is the statement's date, and the reason is
|
|
67
|
+
* not tidiness: a member enters one figure, not their history,
|
|
68
|
+
* so anything earlier would be that figure run BACKWARDS
|
|
69
|
+
* through rates nobody checked. An inverse calculation drawn
|
|
70
|
+
* as history is a claim the tool cannot support.
|
|
71
|
+
*/
|
|
72
|
+
export function buildCurve(cash, todays) {
|
|
73
|
+
const { today, dateOfBirth, retirementDate, npa } = cash;
|
|
74
|
+
const endAge = Math.max(npa + 5, yearsBetween(dateOfBirth, retirementDate) + 5);
|
|
75
|
+
/** The scheme year an age's birthday falls in. */
|
|
76
|
+
const yearOfAge = (age) => schemeYearEndFor(new Date(dateOfBirth.getFullYear() + age, dateOfBirth.getMonth(), dateOfBirth.getDate()));
|
|
77
|
+
/** The age whose birthday falls in a scheme year — the
|
|
78
|
+
* inverse, used once to find where the axis starts. */
|
|
79
|
+
const ageInYear = (schemeYearEnd) => {
|
|
80
|
+
const end = schemeYearEndDate(schemeYearEnd);
|
|
81
|
+
const birthday = new Date(schemeYearEnd, dateOfBirth.getMonth(), dateOfBirth.getDate());
|
|
82
|
+
return schemeYearEnd - dateOfBirth.getFullYear()
|
|
83
|
+
- (birthday > end ? 1 : 0);
|
|
84
|
+
};
|
|
85
|
+
const startAge = ageInYear(schemeYearEndFor(cash.curveFrom));
|
|
86
|
+
const points = [];
|
|
87
|
+
for (let label = startAge; label <= Math.ceil(endAge); label++) {
|
|
88
|
+
const year = yearOfAge(label);
|
|
89
|
+
const on = schemeYearEndDate(year);
|
|
90
|
+
/* The age the member actually IS on that 31 March, not the
|
|
91
|
+
whole age whose birthday the scheme year contains.
|
|
92
|
+
|
|
93
|
+
Those differ by anything from nought to twelve months —
|
|
94
|
+
the gap between a birthday and the following 31 March —
|
|
95
|
+
so plotting at the whole age would put a value up to a
|
|
96
|
+
year early on the x-axis, and a "today" point falling in
|
|
97
|
+
that gap would sit out of order with its neighbours.
|
|
98
|
+
|
|
99
|
+
Built as WHOLE AGE + fraction rather than as a span in
|
|
100
|
+
365.25-day years, so that `Math.floor(age)` is the age
|
|
101
|
+
the member actually is on that 31 March — by calendar
|
|
102
|
+
arithmetic, not within a rounding of it. Someone born on
|
|
103
|
+
1 April reads 42.997 at the year end before their 43rd
|
|
104
|
+
birthday, which floors correctly today and sits three
|
|
105
|
+
thousandths from flooring wrongly after enough leap
|
|
106
|
+
days. The fraction orders the points; the whole part is
|
|
107
|
+
exact. */
|
|
108
|
+
const age = ageAtYearEnd(dateOfBirth, on);
|
|
109
|
+
/* Two walks meet here, and the estimate owns everything up
|
|
110
|
+
to and including the statement's own year — its last row
|
|
111
|
+
IS the stated balance, so reading it there rather than
|
|
112
|
+
the main ledger changes nothing and keeps the join
|
|
113
|
+
seamless. */
|
|
114
|
+
const from = (r) => r.history !== null && year <= r.history.to
|
|
115
|
+
? r.history.ledger
|
|
116
|
+
: r.ledger;
|
|
117
|
+
const row = from(cash).years.find((r) => r.schemeYearEnd === year);
|
|
118
|
+
points.push({
|
|
119
|
+
age,
|
|
120
|
+
nominal: from(cash).atDate(on),
|
|
121
|
+
real: from(todays).atDate(on),
|
|
122
|
+
accrued: on <= today,
|
|
123
|
+
/* Off the row where there is one, and otherwise from the
|
|
124
|
+
SAME rule the row was built by — never a second copy of
|
|
125
|
+
it here. Compared by scheme YEAR, matching the ledger:
|
|
126
|
+
a point sits at a 31 March close, so a member who left
|
|
127
|
+
in January of that year would read as deferred on the
|
|
128
|
+
very year they were still paying in. */
|
|
129
|
+
phase: row?.phase ?? phaseAt(year, schemeYearEndFor(cash.exitDate), schemeYearEndFor(cash.retirementDate)),
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return points;
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=curve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"curve.js","sourceRoot":"","sources":["../../src/pension/curve.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAC,iBAAiB,EAAE,gBAAgB,EAAC,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAC;AAoCpC;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,OAAa,EAAE,UAAgB;IACzD,OAAO,IAAI,CAAC,GAAG,CACb,gBAAgB,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CACxD,GAAG,CAAC,CAAC;AACR,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,YAAY,CAAC,WAAiB,EAAE,EAAQ;IAC/C,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,IAAI,CAC3C,IAAI,EAAE,WAAW,CAAC,QAAQ,EAAE,EAAE,WAAW,CAAC,OAAO,EAAE,CACpD,CAAC;IACF,MAAM,QAAQ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C,aAAa,KAAK,IAAI,CAChC,CAAC;QACF,MAAM,CAAC,IAAI,CAAC;YACV,GAAG;YACH,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;YAC9B,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7B,OAAO,EAAE,EAAE,IAAI,KAAK;YACpB;;;;;sDAK0C;YAC1C,KAAK,EAAE,GAAG,EAAE,KAAK,IAAI,OAAO,CAC1B,IAAI,EACJ,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAC/B,gBAAgB,CAAC,IAAI,CAAC,cAAc,CAAC,CACtC;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/pension/history.js
CHANGED
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
* year's pay award inside them, so averaging them raw mixes
|
|
70
70
|
* 2021 pounds with 2025 pounds and reads low by a tenth.
|
|
71
71
|
*/
|
|
72
|
-
import { buildLedger } from './ledger.js';
|
|
72
|
+
import { buildLedger, flatPay } from './ledger.js';
|
|
73
73
|
import { firstWalkedYear, schemeYearEndDate, seedFromJoinDate, } from './seed.js';
|
|
74
74
|
/**
|
|
75
75
|
* Estimate the years from `joinDate` up to a stated balance.
|
|
@@ -85,9 +85,9 @@ export function estimateHistory({ joinDate, statedBalance, statementSchemeYearEn
|
|
|
85
85
|
if (first > statementSchemeYearEnd || statedBalance <= 0) {
|
|
86
86
|
return null;
|
|
87
87
|
}
|
|
88
|
-
const walk = (
|
|
88
|
+
const walk = (pay) => buildLedger({
|
|
89
89
|
seed,
|
|
90
|
-
|
|
90
|
+
payIn: flatPay(pay),
|
|
91
91
|
// Accruing throughout, and drawing far enough out that no
|
|
92
92
|
// retirement factor lands inside the window.
|
|
93
93
|
exitDate: schemeYearEndDate(statementSchemeYearEnd),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/pension/history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AAEH,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/pension/history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AAEH,OAAO,EAAC,WAAW,EAAE,OAAO,EAAC,MAAM,aAAa,CAAC;AAGjD,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAqBnB;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,EAC9B,QAAQ,EACR,aAAa,EACb,sBAAsB,EACtB,MAAM,GAMP;IACC,MAAM,IAAI,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,KAAK,GAAG,sBAAsB,IAAI,aAAa,IAAI,CAAC,EAAE,CAAC;QACzD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,IAAI,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,WAAW,CAAC;QACxC,IAAI;QACJ,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC;QACnB,0DAA0D;QAC1D,6CAA6C;QAC7C,QAAQ,EAAE,iBAAiB,CAAC,sBAAsB,CAAC;QACnD,cAAc,EAAE,iBAAiB,CAAC,sBAAsB,GAAG,EAAE,CAAC;QAC9D,MAAM;QACN,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI;QACtB,OAAO,EAAE,sBAAsB;KAChC,CAAC,CAAC;IAEH,4DAA4D;IAC5D,kDAAkD;IAClD,MAAM,QAAQ,G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