@casomoltd/nhs-pay 0.30.0 → 0.31.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 +69 -251
- package/dist/bands.d.ts +9 -1
- package/dist/bands.js +20 -0
- package/dist/bands.js.map +1 -1
- package/dist/document-source.d.ts +16 -0
- package/dist/document-source.js +3 -1
- package/dist/document-source.js.map +1 -1
- package/dist/errors.d.ts +46 -11
- package/dist/errors.js +68 -28
- package/dist/errors.js.map +1 -1
- package/dist/factor-basis.d.ts +14 -0
- package/dist/factor-basis.js.map +1 -1
- package/dist/index.d.ts +13 -11
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/member/benefits.js +18 -11
- package/dist/member/benefits.js.map +1 -1
- package/dist/member/index.d.ts +1 -1
- package/dist/member/input-period.d.ts +4 -4
- package/dist/member/input-period.js +11 -9
- package/dist/member/input-period.js.map +1 -1
- package/dist/member/service.d.ts +4 -0
- package/dist/member/service.js +9 -3
- package/dist/member/service.js.map +1 -1
- package/dist/member/types.d.ts +81 -49
- package/dist/member/types.js.map +1 -1
- package/dist/member/valuation.d.ts +10 -8
- package/dist/member/valuation.js +17 -21
- package/dist/member/valuation.js.map +1 -1
- package/dist/pay-path.d.ts +21 -25
- package/dist/pay-path.js +85 -67
- package/dist/pay-path.js.map +1 -1
- package/dist/pension/ages.d.ts +6 -4
- package/dist/pension/ages.js +6 -4
- package/dist/pension/ages.js.map +1 -1
- package/dist/pension/curve.d.ts +2 -1
- package/dist/pension/curve.js +15 -7
- package/dist/pension/curve.js.map +1 -1
- package/dist/pension/history.d.ts +18 -3
- package/dist/pension/history.js +12 -5
- package/dist/pension/history.js.map +1 -1
- package/dist/pension/ledger.d.ts +15 -9
- package/dist/pension/ledger.js +91 -56
- package/dist/pension/ledger.js.map +1 -1
- package/dist/pension/prices.d.ts +11 -2
- package/dist/pension/prices.js +35 -14
- package/dist/pension/prices.js.map +1 -1
- package/dist/pension/scheme-year.d.ts +59 -0
- package/dist/pension/scheme-year.js +80 -0
- package/dist/pension/scheme-year.js.map +1 -0
- package/dist/pension/seed.d.ts +66 -50
- package/dist/pension/seed.js +111 -65
- package/dist/pension/seed.js.map +1 -1
- package/dist/pension/uplift.d.ts +13 -33
- package/dist/pension/uplift.js +11 -56
- package/dist/pension/uplift.js.map +1 -1
- package/dist/pension-projection.js +30 -22
- package/dist/pension-projection.js.map +1 -1
- package/dist/post.d.ts +1 -10
- package/dist/post.js +1 -12
- package/dist/post.js.map +1 -1
- package/dist/revaluation.d.ts +34 -35
- package/dist/revaluation.js +41 -41
- package/dist/revaluation.js.map +1 -1
- package/dist/scale-point.d.ts +6 -0
- package/dist/sections/final-salary.d.ts +3 -8
- package/dist/sections/final-salary.js +13 -9
- package/dist/sections/final-salary.js.map +1 -1
- package/dist/sections/section-2015.d.ts +2 -1
- package/dist/sections/section-2015.js.map +1 -1
- package/dist/sources.d.ts +10 -0
- package/dist/sources.js +20 -0
- package/dist/sources.js.map +1 -1
- package/dist/take-home.d.ts +4 -20
- package/dist/take-home.js +3 -23
- package/dist/take-home.js.map +1 -1
- package/package.json +3 -3
|
@@ -155,9 +155,9 @@ import { earliest, npaDate, periodInYearsMonths, } from './dates.js';
|
|
|
155
155
|
import { createPrices } from './pension/prices.js';
|
|
156
156
|
import { ACCRUAL_RATE, atDrawing, buildLedger, flatPay, } from './pension/ledger.js';
|
|
157
157
|
import { estimateHistory } from './pension/history.js';
|
|
158
|
-
import { seedFromBalanceAt } from './pension/uplift.js';
|
|
159
158
|
import { buildCurve, walkThrough } from './pension/curve.js';
|
|
160
|
-
import {
|
|
159
|
+
import { schemeYearBefore, schemeYearEndDate } from './pension/scheme-year.js';
|
|
160
|
+
import { seedFromBalanceAt, seedFromJoinDate } from './pension/seed.js';
|
|
161
161
|
import { FACTOR_TABLES, factorTable } from './factor-basis.js';
|
|
162
162
|
// ── Constants ───────────────────────────────────────
|
|
163
163
|
/* The accrual rate is owned by the ledger that applies it and
|
|
@@ -289,8 +289,30 @@ export function projectPension(input, today = new Date()) {
|
|
|
289
289
|
todaysMoneyLedger: todays.ledger,
|
|
290
290
|
};
|
|
291
291
|
}
|
|
292
|
+
/** The flat-pay walk from `seed` to the drawing, and the factor the
|
|
293
|
+
* drawing takes. */
|
|
294
|
+
function walkToDrawing(input, seed, prices) {
|
|
295
|
+
const { currentSalary, dateOfBirth, exitDate, retirementDate, npa } = input;
|
|
296
|
+
const { factor, type: factorType } = retirementFactor(retirementDate, npaDate(dateOfBirth, npa));
|
|
297
|
+
const ledger = buildLedger({
|
|
298
|
+
seed,
|
|
299
|
+
payIn: flatPay(currentSalary),
|
|
300
|
+
exitDate,
|
|
301
|
+
retirementDate,
|
|
302
|
+
prices,
|
|
303
|
+
through: walkThrough(retirementDate, npaDate(dateOfBirth, npa)),
|
|
304
|
+
drawingFor: () => ({
|
|
305
|
+
on: retirementDate,
|
|
306
|
+
factor,
|
|
307
|
+
table: factorType === null
|
|
308
|
+
? null
|
|
309
|
+
: { kind: factorType, provenance: factorProvenance(factorType) },
|
|
310
|
+
}),
|
|
311
|
+
});
|
|
312
|
+
return { ledger, factor, factorType };
|
|
313
|
+
}
|
|
292
314
|
function resolveProjection(input, today) {
|
|
293
|
-
const {
|
|
315
|
+
const { dateOfBirth, exitDate, retirementDate, npa, assumedCpi } = input;
|
|
294
316
|
/* The drawing date is used EXACTLY AS GIVEN, to the day.
|
|
295
317
|
Retiring on a birthday, mid-month, or on a scheme year end
|
|
296
318
|
are three different questions and this function answers
|
|
@@ -310,24 +332,8 @@ function resolveProjection(input, today) {
|
|
|
310
332
|
// The ONLY place the input variant is read.
|
|
311
333
|
const seed = isEstimation
|
|
312
334
|
? seedFromJoinDate(input.joinDate)
|
|
313
|
-
: seedFromBalanceAt(input.accruedPension, input.statementDate, exitDate, retirementDate, prices);
|
|
314
|
-
const { factor,
|
|
315
|
-
const through = walkThrough(retirementDate, npaDate(dateOfBirth, npa));
|
|
316
|
-
const ledger = buildLedger({
|
|
317
|
-
seed,
|
|
318
|
-
payIn: flatPay(currentSalary),
|
|
319
|
-
exitDate,
|
|
320
|
-
retirementDate,
|
|
321
|
-
prices,
|
|
322
|
-
through,
|
|
323
|
-
drawingFor: () => ({
|
|
324
|
-
on: retirementDate,
|
|
325
|
-
factor,
|
|
326
|
-
table: factorType === null
|
|
327
|
-
? null
|
|
328
|
-
: { kind: factorType, provenance: factorProvenance(factorType) },
|
|
329
|
-
}),
|
|
330
|
-
});
|
|
335
|
+
: seedFromBalanceAt({ balance: input.accruedPension, asOf: input.statementDate }, exitDate, retirementDate, prices);
|
|
336
|
+
const { ledger, factor, factorType } = walkToDrawing(input, seed, prices);
|
|
331
337
|
const { revalued, drawn } = atDrawing(ledger, retirementDate, factor);
|
|
332
338
|
/* Illustration only, and only where a statement leaves a gap:
|
|
333
339
|
an estimation path already walks from the join date, so
|
|
@@ -353,7 +359,9 @@ function resolveProjection(input, today) {
|
|
|
353
359
|
other; starting the curve at today withholds them.
|
|
354
360
|
Starting at today would also put a past leaving date
|
|
355
361
|
outside the curve's range. */
|
|
356
|
-
curveFrom: earliest(today, exitDate, schemeYearEndDate(history === null
|
|
362
|
+
curveFrom: earliest(today, exitDate, schemeYearEndDate(history === null
|
|
363
|
+
? seed.atSchemeYearEnd
|
|
364
|
+
: schemeYearBefore(history.from))),
|
|
357
365
|
// The leaving row settles on the last day of service, so the
|
|
358
366
|
// entitlement is read there, before any retirement factor.
|
|
359
367
|
accruedAtExit: ledger.accruedAt(exitDate),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pension-projection.js","sourceRoot":"","sources":["../src/pension-projection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwJG;AAEH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MAAM;QACzD;;;;;;;wCAOgC;QAChC,SAAS,EAAE,QAAQ,CACjB,KAAK,EACL,QAAQ,EACR,iBAAiB,CACf,OAAO,KAAK,IAAI;YACd,CAAC,CAAC,IAAI,CAAC,eAAe;YACtB,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,CACnC,CACF;QACD,6DAA6D;QAC7D,2DAA2D;QAC3D,aAAa,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC;QACzC,oBAAoB,EAAE,QAAQ;QAC9B,aAAa,EAAE,KAAK;KACrB,CAAC;AACJ,CAAC"}
|
package/dist/post.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* a value by building a new one (see {@link Post.withSalary},
|
|
11
11
|
* {@link Post.withAdjustments}).
|
|
12
12
|
*/
|
|
13
|
-
import type { Nation, PayYear, TaxYear, TakeHomePay,
|
|
13
|
+
import type { Nation, PayYear, TaxYear, TakeHomePay, StudentLoanPlan, TaxCode } from '@casomoltd/paye-calc';
|
|
14
14
|
import type { Role } from './role.js';
|
|
15
15
|
import type { DocumentSource } from './document-source.js';
|
|
16
16
|
import type { PayAward } from './award.js';
|
|
@@ -196,15 +196,6 @@ export declare class Post {
|
|
|
196
196
|
private get _pensionFraction();
|
|
197
197
|
/** Full take-home breakdown (tax, NI, pension, net). */
|
|
198
198
|
get takeHome(): TakeHomePay;
|
|
199
|
-
/**
|
|
200
|
-
* The pension annual allowance this post's year meets, with the
|
|
201
|
-
* scheme's defined-benefit pension input: read it here, not off
|
|
202
|
-
* `takeHome`, whose own allowance has no scheme input. The input is
|
|
203
|
-
* this year's accrual alone (`nhsAnnualAllowance`): a post knows no
|
|
204
|
-
* member history, so revaluation of pension already built up is not
|
|
205
|
-
* counted.
|
|
206
|
-
*/
|
|
207
|
-
get annualAllowance(): AnnualAllowance;
|
|
208
199
|
/** Annual income tax (£). */
|
|
209
200
|
get tax(): number;
|
|
210
201
|
/** Annual national insurance (£). */
|
package/dist/post.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { nationToTaxRegion } from '@casomoltd/paye-calc';
|
|
14
14
|
import { getPensionTiersVO } from './pension.js';
|
|
15
|
-
import {
|
|
15
|
+
import { nhsTakeHome } from './take-home.js';
|
|
16
16
|
import { awardsFor } from './award.js';
|
|
17
17
|
import { afcScaleSource } from './scales.js';
|
|
18
18
|
import { ScaleUnavailable } from './errors.js';
|
|
@@ -201,17 +201,6 @@ export class Post {
|
|
|
201
201
|
taxCode: this.adjustments.taxCode,
|
|
202
202
|
});
|
|
203
203
|
}
|
|
204
|
-
/**
|
|
205
|
-
* The pension annual allowance this post's year meets, with the
|
|
206
|
-
* scheme's defined-benefit pension input: read it here, not off
|
|
207
|
-
* `takeHome`, whose own allowance has no scheme input. The input is
|
|
208
|
-
* this year's accrual alone (`nhsAnnualAllowance`): a post knows no
|
|
209
|
-
* member history, so revaluation of pension already built up is not
|
|
210
|
-
* counted.
|
|
211
|
-
*/
|
|
212
|
-
get annualAllowance() {
|
|
213
|
-
return nhsAnnualAllowance(this.pensionablePay, this._pensionFraction, this.identity.taxYear, nationToTaxRegion(this.identity.nation));
|
|
214
|
-
}
|
|
215
204
|
/** Annual income tax (£). */
|
|
216
205
|
get tax() {
|
|
217
206
|
return this.takeHome.incomeTax;
|
package/dist/post.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post.js","sourceRoot":"","sources":["../src/post.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"post.js","sourceRoot":"","sources":["../src/post.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AASvD,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAC/C,OAAO,EA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AAmB;QACrB,OAAO,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IACxC,CAAC;IAED;qCACiC;IACjC,IAAY,gBAAgB;QAC1B,OAAO,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC;IACrC,CAAC;IAED,wDAAwD;IACxD,IAAI,QAAQ;QACV,OAAO,WAAW,CAChB,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,gBAAgB,EACrB,IAAI,CAAC,QAAQ,CAAC,OAAO,EACrB,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EACvC;YACE,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,YAAY;YAC3C,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO;SAClC,CACF,CAAC;IACJ,CAAC;IAED,6BAA6B;IAC7B,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;IACjC,CAAC;IAED,qCAAqC;IACrC,IAAI,iBAAiB;QACnB,OAAO,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC;IACzC,CAAC;IAED,0DAA0D;IAC1D,UAAU,CAAC,MAAc;QACvB,OAAO,IAAI,IAAI,CACb,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CACnD,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,eAAe,CAAC,KAA+B;QAC7C,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE;YACrD,GAAG,IAAI,CAAC,WAAW;YACnB,GAAG,KAAK;SACT,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/revaluation.d.ts
CHANGED
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
*
|
|
21
21
|
* "HM Treasury HCWS437 — Public Service Pension
|
|
22
22
|
* Scheme Indexation and Revaluation 2025", the
|
|
23
|
-
* Chief Secretary's annual written ministerial statement.
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
23
|
+
* Chief Secretary's annual written ministerial statement. It
|
|
24
|
+
* states why the date moved to 6 April, and its per-scheme table
|
|
25
|
+
* is a source of the applied-rate fixture, independent of the
|
|
26
|
+
* Order and of the valuation report.
|
|
27
27
|
*
|
|
28
28
|
* "SPPA NHS Circular 2023/01 — pension indexation and CARE
|
|
29
29
|
* revaluation" — the clearest annual statement of the exact NHS
|
|
@@ -32,8 +32,10 @@
|
|
|
32
32
|
*
|
|
33
33
|
* "NHS Pension Scheme Valuation Report 2020", Appendix E
|
|
34
34
|
* "Inter-valuation events" — the in-service revaluation as
|
|
35
|
-
* ACTUALLY APPLIED, year by year from April 2016
|
|
36
|
-
* rate
|
|
35
|
+
* ACTUALLY APPLIED, year by year from April 2016, independent of
|
|
36
|
+
* the orders. No rate is held here: the rule derives it from the
|
|
37
|
+
* Order's CPI (`activeRatePct`), and the applied rates are the
|
|
38
|
+
* test oracle in `tests/fixtures/revaluation-applied.csv`.
|
|
37
39
|
*
|
|
38
40
|
* "SI 2015/94 Sch 9 para 3 — revaluation": the NHS Pension
|
|
39
41
|
* Scheme Regulations 2015 add 1.5 to the prices "increase or
|
|
@@ -43,13 +45,12 @@
|
|
|
43
45
|
* "NHSBSA KA-02728 — how your pension is revalued", on how it is
|
|
44
46
|
* applied to members and on the date change below.
|
|
45
47
|
*
|
|
46
|
-
*
|
|
47
|
-
* Annual Benefit Statement (2015 Section, updated
|
|
48
|
-
* 31/03/2025; name and membership number redacted)
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* here: the earnings beside that column are the member's.
|
|
48
|
+
* The fixture is cross-checked against the "Revaluation" column
|
|
49
|
+
* of a member's Annual Benefit Statement (2015 Section, updated
|
|
50
|
+
* to 31/03/2025; name and membership number redacted): the rates
|
|
51
|
+
* as actually applied to a real record, rather than as
|
|
52
|
+
* legislated. Nothing else from that document is used: the
|
|
53
|
+
* earnings beside that column are the member's.
|
|
53
54
|
* Archived as "Annual Benefit Statement, 2015 Section,
|
|
54
55
|
* redacted" — see docs/source-archive.md.
|
|
55
56
|
*
|
|
@@ -61,13 +62,13 @@
|
|
|
61
62
|
* than letting a scheme-year boundary be assumed.
|
|
62
63
|
*
|
|
63
64
|
* **CPI is sourced independently of the rate**, never derived
|
|
64
|
-
* from it. Taking `septemberCpiPct =
|
|
65
|
+
* from it. Taking `septemberCpiPct = rate - 1.5` would make
|
|
65
66
|
* the test that checks the +1.5 rule agree with itself, which
|
|
66
|
-
* is no test at all. So the two
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* table
|
|
67
|
+
* is no test at all. So the two come from documents that do
|
|
68
|
+
* not cite each other: prices here, from each Treasury Order's
|
|
69
|
+
* own operative words, and the rate AS APPLIED in a test
|
|
70
|
+
* fixture, from the 2020 valuation report's inter-valuation
|
|
71
|
+
* table and a member's statement.
|
|
71
72
|
*
|
|
72
73
|
* **A negative prices figure is carried through, not floored.**
|
|
73
74
|
* September 2015 CPI was -0.1% and the 2016 order specifies a
|
|
@@ -86,9 +87,9 @@
|
|
|
86
87
|
* in-service revaluation was applied in April 2016. All eleven
|
|
87
88
|
* years to 2026 are here, which is what lets a projection walk
|
|
88
89
|
* a member's whole membership rather than only the part since
|
|
89
|
-
* their statement. `revaluationFor`
|
|
90
|
-
*
|
|
91
|
-
*
|
|
90
|
+
* their statement. `revaluationFor` returns null rather than
|
|
91
|
+
* guessing for a year not held: one before 2016, or one whose
|
|
92
|
+
* order has not yet been made.
|
|
92
93
|
*
|
|
93
94
|
* ── Not this table ──────────────────────────────────
|
|
94
95
|
*
|
|
@@ -97,15 +98,14 @@
|
|
|
97
98
|
* different instrument. For 1995/2008 practitioners the
|
|
98
99
|
* equivalent uplift is earnings dynamisation, not this.
|
|
99
100
|
*/
|
|
101
|
+
import type { SchemeYearEnd } from './pension/scheme-year.js';
|
|
100
102
|
/** One scheme year's revaluation, and what set it. */
|
|
101
103
|
export interface RevaluationYear {
|
|
102
104
|
/** Scheme year END, e.g. 2022 for the 2021/22 year. */
|
|
103
|
-
readonly yearEnd:
|
|
105
|
+
readonly yearEnd: SchemeYearEnd;
|
|
104
106
|
/** The Treasury Order prices figure — the previous
|
|
105
107
|
* September's CPI, as a percentage. Sourced, not derived. */
|
|
106
108
|
readonly septemberCpiPct: number;
|
|
107
|
-
/** The in-service revaluation applied, as a percentage. */
|
|
108
|
-
readonly ratePct: number;
|
|
109
109
|
/** ISO date the MEMBER'S POT moves — not the date the order
|
|
110
110
|
* commences. Every Revaluation Order commences 1 April; the
|
|
111
111
|
* NHS scheme moved its own application to 6 April from 2023
|
|
@@ -125,22 +125,21 @@ export interface RevaluationYear {
|
|
|
125
125
|
/** The bonus the scheme adds to CPI while a member is paying
|
|
126
126
|
* in, in PERCENTAGE POINTS. Added, never compounded. */
|
|
127
127
|
export declare const ACTIVE_REVAL_BONUS_PCT = 1.5;
|
|
128
|
-
/** In-service revaluation, oldest first
|
|
129
|
-
* Revaluation Order is made — a year's rate is known months
|
|
130
|
-
* before the year it applies to ends. */
|
|
128
|
+
/** In-service revaluation, oldest first, each year a `SchemeYearEnd`. */
|
|
131
129
|
export declare const IN_SERVICE_REVALUATION: readonly RevaluationYear[];
|
|
132
130
|
/** The published rate for a scheme year, or null where the
|
|
133
131
|
* year isn't published — never a silent fallback. */
|
|
134
|
-
export declare function revaluationFor(yearEnd:
|
|
132
|
+
export declare function revaluationFor(yearEnd: SchemeYearEnd): RevaluationYear | null;
|
|
135
133
|
/**
|
|
136
134
|
* The date the pot moves for a given scheme year: 6 April from
|
|
137
|
-
* 2023, 1 April before it — read off the table
|
|
135
|
+
* 2023, 1 April before it — read off the table where the year's
|
|
136
|
+
* Order is held, and 6 April, the scheme's day since 2023, for a
|
|
137
|
+
* year whose Order is not yet made.
|
|
138
138
|
*
|
|
139
139
|
* Lives here rather than with the uplift rule because two
|
|
140
140
|
* callers need it and they must agree: the pension steps on
|
|
141
|
-
* these days, and so must the ruler that reads it
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* deflated a year that had not passed.
|
|
141
|
+
* these days, and so must the ruler that reads it, or a ruler
|
|
142
|
+
* anchored before 2023 counts its own anchor step five days
|
|
143
|
+
* early and deflates a year that has not passed.
|
|
145
144
|
*/
|
|
146
|
-
export declare function appliedOnFor(yearEnd:
|
|
145
|
+
export declare function appliedOnFor(yearEnd: SchemeYearEnd): Date;
|
package/dist/revaluation.js
CHANGED
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
*
|
|
21
21
|
* "HM Treasury HCWS437 — Public Service Pension
|
|
22
22
|
* Scheme Indexation and Revaluation 2025", the
|
|
23
|
-
* Chief Secretary's annual written ministerial statement.
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
23
|
+
* Chief Secretary's annual written ministerial statement. It
|
|
24
|
+
* states why the date moved to 6 April, and its per-scheme table
|
|
25
|
+
* is a source of the applied-rate fixture, independent of the
|
|
26
|
+
* Order and of the valuation report.
|
|
27
27
|
*
|
|
28
28
|
* "SPPA NHS Circular 2023/01 — pension indexation and CARE
|
|
29
29
|
* revaluation" — the clearest annual statement of the exact NHS
|
|
@@ -32,8 +32,10 @@
|
|
|
32
32
|
*
|
|
33
33
|
* "NHS Pension Scheme Valuation Report 2020", Appendix E
|
|
34
34
|
* "Inter-valuation events" — the in-service revaluation as
|
|
35
|
-
* ACTUALLY APPLIED, year by year from April 2016
|
|
36
|
-
* rate
|
|
35
|
+
* ACTUALLY APPLIED, year by year from April 2016, independent of
|
|
36
|
+
* the orders. No rate is held here: the rule derives it from the
|
|
37
|
+
* Order's CPI (`activeRatePct`), and the applied rates are the
|
|
38
|
+
* test oracle in `tests/fixtures/revaluation-applied.csv`.
|
|
37
39
|
*
|
|
38
40
|
* "SI 2015/94 Sch 9 para 3 — revaluation": the NHS Pension
|
|
39
41
|
* Scheme Regulations 2015 add 1.5 to the prices "increase or
|
|
@@ -43,13 +45,12 @@
|
|
|
43
45
|
* "NHSBSA KA-02728 — how your pension is revalued", on how it is
|
|
44
46
|
* applied to members and on the date change below.
|
|
45
47
|
*
|
|
46
|
-
*
|
|
47
|
-
* Annual Benefit Statement (2015 Section, updated
|
|
48
|
-
* 31/03/2025; name and membership number redacted)
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* here: the earnings beside that column are the member's.
|
|
48
|
+
* The fixture is cross-checked against the "Revaluation" column
|
|
49
|
+
* of a member's Annual Benefit Statement (2015 Section, updated
|
|
50
|
+
* to 31/03/2025; name and membership number redacted): the rates
|
|
51
|
+
* as actually applied to a real record, rather than as
|
|
52
|
+
* legislated. Nothing else from that document is used: the
|
|
53
|
+
* earnings beside that column are the member's.
|
|
53
54
|
* Archived as "Annual Benefit Statement, 2015 Section,
|
|
54
55
|
* redacted" — see docs/source-archive.md.
|
|
55
56
|
*
|
|
@@ -61,13 +62,13 @@
|
|
|
61
62
|
* than letting a scheme-year boundary be assumed.
|
|
62
63
|
*
|
|
63
64
|
* **CPI is sourced independently of the rate**, never derived
|
|
64
|
-
* from it. Taking `septemberCpiPct =
|
|
65
|
+
* from it. Taking `septemberCpiPct = rate - 1.5` would make
|
|
65
66
|
* the test that checks the +1.5 rule agree with itself, which
|
|
66
|
-
* is no test at all. So the two
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* table
|
|
67
|
+
* is no test at all. So the two come from documents that do
|
|
68
|
+
* not cite each other: prices here, from each Treasury Order's
|
|
69
|
+
* own operative words, and the rate AS APPLIED in a test
|
|
70
|
+
* fixture, from the 2020 valuation report's inter-valuation
|
|
71
|
+
* table and a member's statement.
|
|
71
72
|
*
|
|
72
73
|
* **A negative prices figure is carried through, not floored.**
|
|
73
74
|
* September 2015 CPI was -0.1% and the 2016 order specifies a
|
|
@@ -86,9 +87,9 @@
|
|
|
86
87
|
* in-service revaluation was applied in April 2016. All eleven
|
|
87
88
|
* years to 2026 are here, which is what lets a projection walk
|
|
88
89
|
* a member's whole membership rather than only the part since
|
|
89
|
-
* their statement. `revaluationFor`
|
|
90
|
-
*
|
|
91
|
-
*
|
|
90
|
+
* their statement. `revaluationFor` returns null rather than
|
|
91
|
+
* guessing for a year not held: one before 2016, or one whose
|
|
92
|
+
* order has not yet been made.
|
|
92
93
|
*
|
|
93
94
|
* ── Not this table ──────────────────────────────────
|
|
94
95
|
*
|
|
@@ -97,13 +98,19 @@
|
|
|
97
98
|
* different instrument. For 1995/2008 practitioners the
|
|
98
99
|
* equivalent uplift is earnings dynamisation, not this.
|
|
99
100
|
*/
|
|
101
|
+
import { schemeYearEnd } from './pension/scheme-year.js';
|
|
102
|
+
/** April, as `Date` counts months from nought. */
|
|
103
|
+
const APRIL_MONTH_INDEX = 3;
|
|
104
|
+
/** The day of April the scheme applies an Order from 2023, and so the day
|
|
105
|
+
* a year with no Order yet is read as moving on. */
|
|
106
|
+
const UPLIFT_DAY_FROM_2023 = 6;
|
|
100
107
|
/** The bonus the scheme adds to CPI while a member is paying
|
|
101
108
|
* in, in PERCENTAGE POINTS. Added, never compounded. */
|
|
102
109
|
export const ACTIVE_REVAL_BONUS_PCT = 1.5;
|
|
103
110
|
/** In-service revaluation, oldest first. Extend when the next
|
|
104
111
|
* Revaluation Order is made — a year's rate is known months
|
|
105
112
|
* before the year it applies to ends. */
|
|
106
|
-
|
|
113
|
+
const REVALUATION_ROWS = [
|
|
107
114
|
{
|
|
108
115
|
// The scheme's FIRST uplift, and the only one from a
|
|
109
116
|
// negative prices figure: September 2015 CPI was -0.1%
|
|
@@ -115,81 +122,72 @@ export const IN_SERVICE_REVALUATION = [
|
|
|
115
122
|
// qualifier.
|
|
116
123
|
yearEnd: 2016,
|
|
117
124
|
septemberCpiPct: -0.1,
|
|
118
|
-
ratePct: 1.4,
|
|
119
125
|
appliedOn: '2016-04-01',
|
|
120
126
|
si: 'SI 2016/438',
|
|
121
127
|
},
|
|
122
128
|
{
|
|
123
129
|
yearEnd: 2017,
|
|
124
130
|
septemberCpiPct: 1.0,
|
|
125
|
-
ratePct: 2.5,
|
|
126
131
|
appliedOn: '2017-04-01',
|
|
127
132
|
si: 'SI 2017/242',
|
|
128
133
|
},
|
|
129
134
|
{
|
|
130
135
|
yearEnd: 2018,
|
|
131
136
|
septemberCpiPct: 3.0,
|
|
132
|
-
ratePct: 4.5,
|
|
133
137
|
appliedOn: '2018-04-01',
|
|
134
138
|
si: 'SI 2018/338',
|
|
135
139
|
},
|
|
136
140
|
{
|
|
137
141
|
yearEnd: 2019,
|
|
138
142
|
septemberCpiPct: 2.4,
|
|
139
|
-
ratePct: 3.9,
|
|
140
143
|
appliedOn: '2019-04-01',
|
|
141
144
|
si: 'SI 2019/455',
|
|
142
145
|
},
|
|
143
146
|
{
|
|
144
147
|
yearEnd: 2020,
|
|
145
148
|
septemberCpiPct: 1.7,
|
|
146
|
-
ratePct: 3.2,
|
|
147
149
|
appliedOn: '2020-04-01',
|
|
148
150
|
si: 'SI 2020/230',
|
|
149
151
|
},
|
|
150
152
|
{
|
|
151
153
|
yearEnd: 2021,
|
|
152
154
|
septemberCpiPct: 0.5,
|
|
153
|
-
ratePct: 2.0,
|
|
154
155
|
appliedOn: '2021-04-01',
|
|
155
156
|
si: 'SI 2021/276',
|
|
156
157
|
},
|
|
157
158
|
{
|
|
158
159
|
yearEnd: 2022,
|
|
159
160
|
septemberCpiPct: 3.1,
|
|
160
|
-
ratePct: 4.6,
|
|
161
161
|
appliedOn: '2022-04-01',
|
|
162
162
|
si: 'SI 2022/215',
|
|
163
163
|
},
|
|
164
164
|
{
|
|
165
165
|
yearEnd: 2023,
|
|
166
166
|
septemberCpiPct: 10.1,
|
|
167
|
-
ratePct: 11.6,
|
|
168
167
|
appliedOn: '2023-04-06',
|
|
169
168
|
si: 'SI 2023/252',
|
|
170
169
|
},
|
|
171
170
|
{
|
|
172
171
|
yearEnd: 2024,
|
|
173
172
|
septemberCpiPct: 6.7,
|
|
174
|
-
ratePct: 8.2,
|
|
175
173
|
appliedOn: '2024-04-06',
|
|
176
174
|
si: 'SI 2024/290',
|
|
177
175
|
},
|
|
178
176
|
{
|
|
179
177
|
yearEnd: 2025,
|
|
180
178
|
septemberCpiPct: 1.7,
|
|
181
|
-
ratePct: 3.2,
|
|
182
179
|
appliedOn: '2025-04-06',
|
|
183
180
|
si: 'SI 2025/252',
|
|
184
181
|
},
|
|
185
182
|
{
|
|
186
183
|
yearEnd: 2026,
|
|
187
184
|
septemberCpiPct: 3.8,
|
|
188
|
-
ratePct: 5.3,
|
|
189
185
|
appliedOn: '2026-04-06',
|
|
190
186
|
si: 'SI 2026/254',
|
|
191
187
|
},
|
|
192
188
|
];
|
|
189
|
+
/** In-service revaluation, oldest first, each year a `SchemeYearEnd`. */
|
|
190
|
+
export const IN_SERVICE_REVALUATION = REVALUATION_ROWS.map((row) => ({ ...row, yearEnd: schemeYearEnd(row.yearEnd) }));
|
|
193
191
|
/** The published rate for a scheme year, or null where the
|
|
194
192
|
* year isn't published — never a silent fallback. */
|
|
195
193
|
export function revaluationFor(yearEnd) {
|
|
@@ -197,19 +195,21 @@ export function revaluationFor(yearEnd) {
|
|
|
197
195
|
}
|
|
198
196
|
/**
|
|
199
197
|
* The date the pot moves for a given scheme year: 6 April from
|
|
200
|
-
* 2023, 1 April before it — read off the table
|
|
198
|
+
* 2023, 1 April before it — read off the table where the year's
|
|
199
|
+
* Order is held, and 6 April, the scheme's day since 2023, for a
|
|
200
|
+
* year whose Order is not yet made.
|
|
201
201
|
*
|
|
202
202
|
* Lives here rather than with the uplift rule because two
|
|
203
203
|
* callers need it and they must agree: the pension steps on
|
|
204
|
-
* these days, and so must the ruler that reads it
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
* deflated a year that had not passed.
|
|
204
|
+
* these days, and so must the ruler that reads it, or a ruler
|
|
205
|
+
* anchored before 2023 counts its own anchor step five days
|
|
206
|
+
* early and deflates a year that has not passed.
|
|
208
207
|
*/
|
|
209
208
|
export function appliedOnFor(yearEnd) {
|
|
210
209
|
const published = revaluationFor(yearEnd);
|
|
211
|
-
if (published === null)
|
|
212
|
-
return new Date(yearEnd,
|
|
210
|
+
if (published === null) {
|
|
211
|
+
return new Date(yearEnd, APRIL_MONTH_INDEX, UPLIFT_DAY_FROM_2023);
|
|
212
|
+
}
|
|
213
213
|
const [y, m, d] = published.appliedOn.split('-').map(Number);
|
|
214
214
|
// Built LOCAL, matching every other date in this library:
|
|
215
215
|
// parsing the ISO string gives UTC midnight, and under BST
|
package/dist/revaluation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revaluation.js","sourceRoot":"","sources":["../src/revaluation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"revaluation.js","sourceRoot":"","sources":["../src/revaluation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmGG;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAGvD,kDAAkD;AAClD,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B;qDACqD;AACrD,MAAM,oBAAoB,GAAG,CAAC,CAAC;AA0B/B;wDACwD;AACxD,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAO1C;;yCAEyC;AACzC,MAAM,gBAAgB,GAA8B;IAClD;QACE,qDAAqD;QACrD,uDAAuD;QACvD,yDAAyD;QACzD,uDAAuD;QACvD,wDAAwD;QACxD,wDAAwD;QACxD,qDAAqD;QACrD,aAAa;QACb,OAAO,EAAE,IAAI;QACb,eAAe,EAAE,CAAC,GAAG;QACrB,SAAS,EAAE,YAAY;QACvB,EAAE,EAAE,aAAa;KAClB;IACD;QACE,OAAO,EAAE,IAAI;QACb,eAAe,EAAE,GAAG;QACpB,SAAS,EAAE,YAA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Ac,CAC5B,OAAsB;IAEtB,OAAO,sBAAsB,CAAC,IAAI,CAChC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,OAAO,CACnC,IAAI,IAAI,CAAC;AACZ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY,CAAC,OAAsB;IACjD,MAAM,SAAS,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAC1C,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACvB,OAAO,IAAI,IAAI,CAAC,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,CAAC,CAAC;IACpE,CAAC;IACD,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7D,0DAA0D;IAC1D,2DAA2D;IAC3D,yCAAyC;IACzC,OAAO,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/B,CAAC"}
|
package/dist/scale-point.d.ts
CHANGED
|
@@ -44,3 +44,9 @@ export interface ScalePoint {
|
|
|
44
44
|
export interface SteppedPoint extends ScalePoint {
|
|
45
45
|
readonly yearsExperience: number;
|
|
46
46
|
}
|
|
47
|
+
/** A scale's points and the one a member is on, which is one of `points`
|
|
48
|
+
* itself, so it cannot name a point the scale does not have. */
|
|
49
|
+
export interface PayLadder {
|
|
50
|
+
readonly points: readonly SteppedPoint[];
|
|
51
|
+
readonly current: SteppedPoint;
|
|
52
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { FactorOutcome } from '../factor-basis.js';
|
|
1
|
+
import type { Factored, FactorOutcome } from '../factor-basis.js';
|
|
2
2
|
import type { PayPath } from '../pay-path.js';
|
|
3
|
-
import type { ProjectionMoney } from '../pension/money.js';
|
|
4
3
|
import type { Prices } from '../pension/prices.js';
|
|
5
4
|
/** The fraction of final pay a year of membership earns: an 80th in the
|
|
6
5
|
* 1995 Section, a 60th in the 2008. */
|
|
@@ -47,12 +46,8 @@ export interface UnreducedPension {
|
|
|
47
46
|
}
|
|
48
47
|
/** A final-salary pension and lump sum, before and after factors. */
|
|
49
48
|
interface FinalSalaryBenefit {
|
|
50
|
-
readonly
|
|
51
|
-
readonly
|
|
52
|
-
readonly automaticLumpSum: ProjectionMoney;
|
|
53
|
-
readonly automaticLumpSumBeforeFactor: ProjectionMoney;
|
|
54
|
-
readonly pensionFactor: FactorOutcome;
|
|
55
|
-
readonly automaticLumpSumFactor: FactorOutcome | null;
|
|
49
|
+
readonly pension: Factored;
|
|
50
|
+
readonly automaticLumpSum: Factored<FactorOutcome | null>;
|
|
56
51
|
readonly membership: number;
|
|
57
52
|
readonly finalPay: number;
|
|
58
53
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { dayAfter, daysBetween } from '../dates.js';
|
|
9
9
|
import { moneyAt } from '../pension/money.js';
|
|
10
|
-
import { schemeYearEndFor, schemeYearStartDate } from '../pension/
|
|
10
|
+
import { schemeYearAfter, schemeYearEnd, schemeYearEndFor, schemeYearStartDate, } from '../pension/scheme-year.js';
|
|
11
11
|
/** How a section measures final pay, named for an award's provenance.
|
|
12
12
|
* The measuring itself is each section's own `finalPay`. */
|
|
13
13
|
export const PAY_MEASURES = {
|
|
@@ -42,12 +42,16 @@ export function finalSalaryBenefit(rules, { windows, payPath, dateOfBirth, leavi
|
|
|
42
42
|
const lumpSum = lumpFactor === null ? 0 : unreducedLump * lumpFactor.factor;
|
|
43
43
|
const money = (real) => moneyAt({ real, nominal: prices.payAt(real, drawing) }, drawing);
|
|
44
44
|
return {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
pension: {
|
|
46
|
+
beforeFactor: money(unreduced),
|
|
47
|
+
after: money(unreduced * pensionFactor.factor),
|
|
48
|
+
factor: pensionFactor,
|
|
49
|
+
},
|
|
50
|
+
automaticLumpSum: {
|
|
51
|
+
beforeFactor: money(unreducedLump),
|
|
52
|
+
after: money(lumpSum),
|
|
53
|
+
factor: lumpFactor,
|
|
54
|
+
},
|
|
51
55
|
membership,
|
|
52
56
|
finalPay: pay,
|
|
53
57
|
};
|
|
@@ -147,9 +151,9 @@ function membershipYears(windows) {
|
|
|
147
151
|
function yearsTo(payPath, leaving, count) {
|
|
148
152
|
const last = schemeYearEndFor(leaving);
|
|
149
153
|
const opened = schemeYearStartDate(last);
|
|
150
|
-
const daysIn = daysBetween(opened, schemeYearStartDate(last
|
|
154
|
+
const daysIn = daysBetween(opened, schemeYearStartDate(schemeYearAfter(last)));
|
|
151
155
|
const share = (daysBetween(opened, leaving) + 1) / daysIn;
|
|
152
|
-
const pay = (year) => payPath.payFor(year).pay;
|
|
156
|
+
const pay = (year) => payPath.payFor(schemeYearEnd(year)).pay;
|
|
153
157
|
const leftOnYearEnd = share === 1;
|
|
154
158
|
return Array.from({ length: count }, (_, back) => (leftOnYearEnd
|
|
155
159
|
? pay(last - back)
|