@casomoltd/nhs-pay 0.26.0 → 0.28.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/dist/additional-pension.js +57 -33
- package/dist/additional-pension.js.map +1 -1
- package/dist/dates.d.ts +2 -0
- package/dist/dates.js +17 -3
- package/dist/dates.js.map +1 -1
- package/dist/factor-basis.d.ts +1 -10
- package/dist/factor-basis.js +1 -10
- package/dist/factor-basis.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/iso-date.d.ts +4 -9
- package/dist/iso-date.js +10 -11
- package/dist/iso-date.js.map +1 -1
- package/dist/member/benefits.d.ts +11 -0
- package/dist/member/benefits.js +179 -0
- package/dist/member/benefits.js.map +1 -0
- package/dist/member/index.d.ts +9 -0
- package/dist/member/index.js +9 -0
- package/dist/member/index.js.map +1 -0
- package/dist/member/service.d.ts +65 -0
- package/dist/member/service.js +166 -0
- package/dist/member/service.js.map +1 -0
- package/dist/{member-benefits.d.ts → member/types.d.ts} +30 -41
- package/dist/member/types.js +46 -0
- package/dist/member/types.js.map +1 -0
- package/dist/member/valuation.d.ts +67 -0
- package/dist/member/valuation.js +157 -0
- package/dist/member/valuation.js.map +1 -0
- package/dist/pension/ages.d.ts +105 -0
- package/dist/pension/ages.js +138 -0
- package/dist/pension/ages.js.map +1 -0
- package/dist/sections/section-1995.js +2 -1
- package/dist/sections/section-1995.js.map +1 -1
- package/dist/sections/section-2008.js +2 -1
- package/dist/sections/section-2008.js.map +1 -1
- package/dist/sections/section-2015.js +1 -1
- package/dist/sections/section-2015.js.map +1 -1
- package/dist/sources.d.ts +19 -2
- package/dist/sources.js +37 -3
- package/dist/sources.js.map +1 -1
- package/package.json +3 -3
- package/dist/member-benefits.js +0 -462
- package/dist/member-benefits.js.map +0 -1
- package/dist/npa.d.ts +0 -28
- package/dist/npa.js +0 -60
- package/dist/npa.js.map +0 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Each section's award for a member, valued at one set of dates: the
|
|
3
|
+
* legacy section on final salary, the 2015 Section and a remedy window
|
|
4
|
+
* on its basis as career average walks, and today's holdings. The
|
|
5
|
+
* owner in `benefits.ts` decides which awards a drawing has and
|
|
6
|
+
* sums them.
|
|
7
|
+
*/
|
|
8
|
+
import type { Award, Holdings, Member, Position, ServicePeriod } from './types.js';
|
|
9
|
+
import type { LegacySectionId, SectionId } from './types.js';
|
|
10
|
+
import type { LegacyHolding } from './service.js';
|
|
11
|
+
import type { JoiningHistory } from '../pension/ages.js';
|
|
12
|
+
import type { PayPath } from '../pay-path.js';
|
|
13
|
+
import type { Prices } from '../pension/prices.js';
|
|
14
|
+
import type { LedgerSeed } from '../pension/seed.js';
|
|
15
|
+
import type { FinalSalaryRules } from '../sections/final-salary.js';
|
|
16
|
+
import { careerAverage } from '../sections/section-2015.js';
|
|
17
|
+
/** Everything about the member, derived once, that every question
|
|
18
|
+
* asked of them reads. */
|
|
19
|
+
export interface Built {
|
|
20
|
+
readonly member: Member;
|
|
21
|
+
/** The dates the member's minimum pension age turns on. */
|
|
22
|
+
readonly history: JoiningHistory;
|
|
23
|
+
readonly today: Date;
|
|
24
|
+
readonly born: Date;
|
|
25
|
+
readonly npaOn: Date;
|
|
26
|
+
readonly payPath: PayPath;
|
|
27
|
+
readonly legacy: LegacyHolding | null;
|
|
28
|
+
readonly ordinary2015: ServicePeriod;
|
|
29
|
+
readonly cashPrices: Prices;
|
|
30
|
+
readonly todaysPrices: Prices;
|
|
31
|
+
}
|
|
32
|
+
/** The dates one set of choices is valued at. */
|
|
33
|
+
export interface Drawing {
|
|
34
|
+
readonly leaving: Date;
|
|
35
|
+
readonly drawing: Date;
|
|
36
|
+
}
|
|
37
|
+
/** A career average run: one window walked in one price series. */
|
|
38
|
+
type CareerAverageRun = ReturnType<typeof careerAverage>;
|
|
39
|
+
/** A career average award and the two runs it was read from. */
|
|
40
|
+
interface CareerAward {
|
|
41
|
+
readonly award: Award;
|
|
42
|
+
readonly cash: CareerAverageRun;
|
|
43
|
+
readonly todays: CareerAverageRun;
|
|
44
|
+
}
|
|
45
|
+
/** What a career average award values: a window of one section, and the
|
|
46
|
+
* seed its walk starts from in each price series. */
|
|
47
|
+
interface CareerWindow {
|
|
48
|
+
readonly section: SectionId;
|
|
49
|
+
readonly window: ServicePeriod;
|
|
50
|
+
readonly seedFor: (prices: Prices) => LedgerSeed;
|
|
51
|
+
}
|
|
52
|
+
/** Each legacy section's statute. */
|
|
53
|
+
export declare const RULES: Record<LegacySectionId, FinalSalaryRules>;
|
|
54
|
+
/** The 2015 Section's own seed: its statement, or its first day. */
|
|
55
|
+
export declare function seed2015(b: Built, { leaving, drawing }: Drawing, prices: Prices): LedgerSeed;
|
|
56
|
+
/** What the member holds today, with the remedy window on the legacy
|
|
57
|
+
* basis: unreduced, since nothing is drawn. */
|
|
58
|
+
export declare function holdings(b: Built): Holdings;
|
|
59
|
+
/** The legacy section's final-salary award over the periods valued on
|
|
60
|
+
* final salary, which the election decides. */
|
|
61
|
+
export declare function legacyAward(b: Built, legacy: LegacyHolding, valued: readonly ServicePeriod[], dates: Drawing): Award;
|
|
62
|
+
/** A career average award over one window, walked in both rulers. */
|
|
63
|
+
export declare function careerAward(b: Built, { section, window, seedFor }: CareerWindow, dates: Drawing): CareerAward;
|
|
64
|
+
/** The 2015 Section's balance, with its estimated run-up before a
|
|
65
|
+
* statement, as the ledgers, history and curve a `Position` carries. */
|
|
66
|
+
export declare function section2015(b: Built, own: CareerAward, { leaving, drawing }: Drawing): Pick<Position, 'ledger' | 'todaysMoneyLedger' | 'estimatedHistory' | 'curve'>;
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { ACCRUALS, SECTIONS } from './types.js';
|
|
2
|
+
import { legacyPeriodsOf, until } from './service.js';
|
|
3
|
+
import { isoToDate } from '../iso-date.js';
|
|
4
|
+
import { normalPensionAge } from '../pension/ages.js';
|
|
5
|
+
import { earliest } from '../dates.js';
|
|
6
|
+
import { buildCurve, walkThrough } from '../pension/curve.js';
|
|
7
|
+
import { seedFromBalanceAt } from '../pension/uplift.js';
|
|
8
|
+
import { estimateHistory } from '../pension/history.js';
|
|
9
|
+
import { moneyAt, sumMoney } from '../pension/money.js';
|
|
10
|
+
import { schemeYearEndDate, schemeYearEndFor, seedFromJoinDate, } from '../pension/seed.js';
|
|
11
|
+
import { finalSalaryBenefit, unreducedPension, } from '../sections/final-salary.js';
|
|
12
|
+
import { RULES_1995 } from '../sections/section-1995.js';
|
|
13
|
+
import { RULES_2008 } from '../sections/section-2008.js';
|
|
14
|
+
import { careerAverage } from '../sections/section-2015.js';
|
|
15
|
+
/** Each legacy section's statute. */
|
|
16
|
+
export const RULES = {
|
|
17
|
+
[SECTIONS.s1995]: RULES_1995,
|
|
18
|
+
[SECTIONS.s2008]: RULES_2008,
|
|
19
|
+
};
|
|
20
|
+
/** The 2015 Section's own seed: its statement, or its first day. */
|
|
21
|
+
export function seed2015(b, { leaving, drawing }, prices) {
|
|
22
|
+
const { statement } = b.member;
|
|
23
|
+
return statement === null
|
|
24
|
+
? seedFromJoinDate(isoToDate(b.ordinary2015.from))
|
|
25
|
+
: seedFromBalanceAt(statement.accruedPension, isoToDate(statement.asAt), leaving, drawing, prices);
|
|
26
|
+
}
|
|
27
|
+
/** What the member holds today, with the remedy window on the legacy
|
|
28
|
+
* basis: unreduced, since nothing is drawn. */
|
|
29
|
+
export function holdings(b) {
|
|
30
|
+
const { today } = b;
|
|
31
|
+
const bySection = [];
|
|
32
|
+
const flat = (x) => moneyAt({ nominal: x, real: x }, today);
|
|
33
|
+
if (b.legacy !== null) {
|
|
34
|
+
const { pension, automaticLumpSum } = unreducedPension(RULES[b.legacy.section], membershipOf(legacyPeriodsOf(b.legacy), today), b.payPath, schemeYearEndFor(today));
|
|
35
|
+
bySection.push({
|
|
36
|
+
section: b.legacy.section,
|
|
37
|
+
pension: flat(pension),
|
|
38
|
+
automaticLumpSum: flat(automaticLumpSum),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
// Any leaving and drawing after today give the same balance today;
|
|
42
|
+
// these are only where the walk has to stop.
|
|
43
|
+
const leaving = b.ordinary2015.to === null
|
|
44
|
+
? b.npaOn
|
|
45
|
+
: isoToDate(b.ordinary2015.to);
|
|
46
|
+
const dates = { leaving, drawing: leaving < b.npaOn ? b.npaOn : leaving };
|
|
47
|
+
const accrued = walk(b, {
|
|
48
|
+
window: b.ordinary2015,
|
|
49
|
+
seed: seed2015(b, dates, b.todaysPrices),
|
|
50
|
+
prices: b.todaysPrices,
|
|
51
|
+
}, dates).ledger.accruedAt(today);
|
|
52
|
+
bySection.push({
|
|
53
|
+
section: SECTIONS.s2015,
|
|
54
|
+
pension: flat(accrued),
|
|
55
|
+
automaticLumpSum: flat(0),
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
bySection, total: sumMoney(bySection.map((x) => x.pension), today),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/** The legacy section's final-salary award over the periods valued on
|
|
62
|
+
* final salary, which the election decides. */
|
|
63
|
+
export function legacyAward(b, legacy, valued, dates) {
|
|
64
|
+
const rules = RULES[legacy.section];
|
|
65
|
+
const benefit = finalSalaryBenefit(rules, {
|
|
66
|
+
windows: membershipOf(valued, dates.leaving),
|
|
67
|
+
payPath: b.payPath, dateOfBirth: b.born, ...dates,
|
|
68
|
+
prices: b.cashPrices,
|
|
69
|
+
});
|
|
70
|
+
return {
|
|
71
|
+
section: legacy.section,
|
|
72
|
+
periods: valued,
|
|
73
|
+
beforeFactor: benefit.beforeFactor,
|
|
74
|
+
pension: benefit.pension,
|
|
75
|
+
automaticLumpSum: benefit.automaticLumpSum,
|
|
76
|
+
factor: benefit.factor,
|
|
77
|
+
ledgers: null,
|
|
78
|
+
provenance: {
|
|
79
|
+
accrual: ACCRUALS.finalSalary,
|
|
80
|
+
denominator: rules.denominator,
|
|
81
|
+
payMeasure: rules.payMeasure,
|
|
82
|
+
membership: benefit.membership,
|
|
83
|
+
finalPay: benefit.finalPay,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/** A career average award over one window, walked in both rulers. */
|
|
88
|
+
export function careerAward(b, { section, window, seedFor }, dates) {
|
|
89
|
+
const walkIn = (prices) => walk(b, { window, seed: seedFor(prices), prices }, dates);
|
|
90
|
+
const cash = walkIn(b.cashPrices);
|
|
91
|
+
const todays = walkIn(b.todaysPrices);
|
|
92
|
+
return {
|
|
93
|
+
award: {
|
|
94
|
+
section,
|
|
95
|
+
periods: [window],
|
|
96
|
+
beforeFactor: moneyAt({ nominal: cash.revalued, real: todays.revalued }, dates.drawing),
|
|
97
|
+
pension: moneyAt({ nominal: cash.drawn, real: todays.drawn }, dates.drawing),
|
|
98
|
+
automaticLumpSum: moneyAt({ nominal: 0, real: 0 }, dates.drawing),
|
|
99
|
+
factor: cash.factor,
|
|
100
|
+
ledgers: { cash: cash.ledger, todaysMoney: todays.ledger },
|
|
101
|
+
provenance: { accrual: ACCRUALS.careerAverage },
|
|
102
|
+
},
|
|
103
|
+
cash,
|
|
104
|
+
todays,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/** The 2015 Section's balance, with its estimated run-up before a
|
|
108
|
+
* statement, as the ledgers, history and curve a `Position` carries. */
|
|
109
|
+
export function section2015(b, own, { leaving, drawing }) {
|
|
110
|
+
const historyIn = (r, prices) => b.member.statement === null
|
|
111
|
+
? null
|
|
112
|
+
: estimateHistory({
|
|
113
|
+
joinDate: isoToDate(b.ordinary2015.from),
|
|
114
|
+
statedBalance: r.seed.opening,
|
|
115
|
+
statementSchemeYearEnd: r.seed.atSchemeYearEnd,
|
|
116
|
+
prices,
|
|
117
|
+
});
|
|
118
|
+
const cashHistory = historyIn(own.cash, b.cashPrices);
|
|
119
|
+
const todaysHistory = historyIn(own.todays, b.todaysPrices);
|
|
120
|
+
const run = (r, history) => ({
|
|
121
|
+
today: b.today, dateOfBirth: b.born, exitDate: leaving,
|
|
122
|
+
retirementDate: drawing, npa: normalPensionAge(b.born),
|
|
123
|
+
ledger: r.ledger, history,
|
|
124
|
+
curveFrom: earliest(b.today, leaving, schemeYearEndDate(history === null
|
|
125
|
+
? r.seed.atSchemeYearEnd
|
|
126
|
+
: history.from - 1)),
|
|
127
|
+
});
|
|
128
|
+
return {
|
|
129
|
+
ledger: own.cash.ledger,
|
|
130
|
+
todaysMoneyLedger: own.todays.ledger,
|
|
131
|
+
estimatedHistory: todaysHistory,
|
|
132
|
+
curve: buildCurve(run(own.cash, cashHistory), run(own.todays, todaysHistory)),
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/** A career average walk over `window`, accruing only inside it. */
|
|
136
|
+
function walk(b, { window, seed, prices }, { leaving, drawing }) {
|
|
137
|
+
const first = schemeYearEndFor(isoToDate(window.from));
|
|
138
|
+
const last = schemeYearEndFor(until(window, leaving));
|
|
139
|
+
return careerAverage({
|
|
140
|
+
seed,
|
|
141
|
+
payIn: (year) => (year >= first && year <= last
|
|
142
|
+
? b.payPath.payFor(year)
|
|
143
|
+
: null),
|
|
144
|
+
dateOfBirth: b.born,
|
|
145
|
+
leaving,
|
|
146
|
+
drawing,
|
|
147
|
+
prices,
|
|
148
|
+
through: walkThrough(drawing, b.npaOn),
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
/** The legacy windows as final-salary membership, to `leaving`. */
|
|
152
|
+
function membershipOf(valued, leaving) {
|
|
153
|
+
return valued
|
|
154
|
+
.filter((p) => isoToDate(p.from) <= leaving)
|
|
155
|
+
.map((p) => ({ from: isoToDate(p.from), to: until(p, leaving) }));
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=valuation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valuation.js","sourceRoot":"","sources":["../../src/member/valuation.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,QAAQ,EAAE,QAA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AM;SACV,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC;SAC3C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,EAAC,CAAC,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ages a member's NHS pension turns on: each section's pension age, the
|
|
3
|
+
* 2015 Section's from their date of birth, and the earliest age they can choose
|
|
4
|
+
* to draw, from when they first joined and when they draw.
|
|
5
|
+
*
|
|
6
|
+
* NORMAL PENSION AGE in the 2015 Section = the member's State Pension age, with
|
|
7
|
+
* a floor of 65 (NHSBSA 2015 Members' Guide V13, May 2024, archived as SA-38 in
|
|
8
|
+
* docs/source-archive.md). The SPA timetable is legislated — Pensions Acts
|
|
9
|
+
* 1995/2007/2011/2014 — and reproduced in DWP's "State Pension age timetables",
|
|
10
|
+
* archived as SA-62 in docs/source-archive.md (last updated 15 May 2014; the
|
|
11
|
+
* legislated dates have not changed since — the 2023 SPA review left them as
|
|
12
|
+
* enacted).
|
|
13
|
+
*
|
|
14
|
+
* Whole years only. The Acts phase each rise through narrow transitional birth
|
|
15
|
+
* cohorts whose exact SPA is 65/66/67 plus some months; `normalPensionAge`
|
|
16
|
+
* returns the NEXT whole year for those cohorts (66/67/68). Rounding up is
|
|
17
|
+
* member-conservative, in the same spirit as the ERF part-month round-up (GAD
|
|
18
|
+
* 2019 guidance §2.3): a projection anchored on the later NPA can understate
|
|
19
|
+
* early-retirement pension by a few months' factor, never overstate it. Callers
|
|
20
|
+
* needing month-exact SPA for the transitional cohorts need the per-cohort tables
|
|
21
|
+
* in the Acts, which this library deliberately does not transcribe.
|
|
22
|
+
*
|
|
23
|
+
* MINIMUM PENSION AGE: who the law's rise reaches, and what everyone else
|
|
24
|
+
* keeps. The rule, its source and what it leaves out are in
|
|
25
|
+
* docs/how-it-works.md#minimum-pension-age.
|
|
26
|
+
*/
|
|
27
|
+
import type { IsoDate } from '../iso-date.js';
|
|
28
|
+
/**
|
|
29
|
+
* The fixed pension ages the legacy sections' factors are measured from,
|
|
30
|
+
* named for the section that sets each: DHSC_PETITION_779519, archived as SA-59
|
|
31
|
+
* in docs/source-archive.md, states "The Normal Pension Age in the NHS Pension
|
|
32
|
+
* Scheme is 60 in the 1995 Section, 65 in the 2008 Section". The factor tables
|
|
33
|
+
* are keyed by pension age, and these are the only two a legacy benefit has;
|
|
34
|
+
* the 2015 Section's is the member's own normal pension age.
|
|
35
|
+
*/
|
|
36
|
+
export declare const LEGACY_PENSION_AGES: {
|
|
37
|
+
readonly section1995: 60;
|
|
38
|
+
readonly section2008: 65;
|
|
39
|
+
};
|
|
40
|
+
/** The age from which the scheme gave every member a right to draw: 55 at
|
|
41
|
+
* the latest, in the 1995 and 2008 Sections and the 2015 Section alike.
|
|
42
|
+
* DHSC's petition response (DHSC_PETITION_779519, archived as SA-59 in
|
|
43
|
+
* docs/source-archive.md) and SPPA's NHS Circular 2025/09 (SA-61) say so.
|
|
44
|
+
* It is the right paye-calc's `minimumPensionAgeFor` protects through the
|
|
45
|
+
* 2028 rise, and so the age an earlier joiner keeps. A lower age kept from
|
|
46
|
+
* 2006 or 2010 is not modelled; what that costs is in
|
|
47
|
+
* docs/how-it-works.md#minimum-pension-age. */
|
|
48
|
+
export declare const MPA_KEPT_AGE = 55;
|
|
49
|
+
/** The last day a member can have first joined and hold that right
|
|
50
|
+
* immediately before paye-calc's `protectedPensionAgeCutoff()`: the day
|
|
51
|
+
* before it. For a caller to show; the rule itself compares against the
|
|
52
|
+
* cut-off. */
|
|
53
|
+
export declare const MPA_RISE_JOINED_AFTER: IsoDate;
|
|
54
|
+
/**
|
|
55
|
+
* Normal pension age for a 2015 Section member born on
|
|
56
|
+
* `dateOfBirth`, in whole years (see the module header for the
|
|
57
|
+
* transitional-cohort rounding).
|
|
58
|
+
*/
|
|
59
|
+
export declare function normalPensionAge(dateOfBirth: Date): number;
|
|
60
|
+
/** The two dates a member's minimum pension age turns on, besides the day
|
|
61
|
+
* they draw: when they were born, and when they first joined the scheme. */
|
|
62
|
+
export interface JoiningHistory {
|
|
63
|
+
readonly born: IsoDate;
|
|
64
|
+
readonly firstJoined: IsoDate;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The earliest age a member can choose to draw a pension on `drawing`, other
|
|
68
|
+
* than through ill health. It depends on two dates:
|
|
69
|
+
*
|
|
70
|
+
* - **When they first joined.** The law (Finance Act 2004 Sch 36 para 23ZB,
|
|
71
|
+
* through paye-calc's `minimumPensionAgeFor`) keeps a protected pension age
|
|
72
|
+
* for a member who held a right to draw before 57 immediately before its
|
|
73
|
+
* cut-off. The scheme gave every member that right from 55
|
|
74
|
+
* (`MPA_KEPT_AGE`), so this is anyone in it by `MPA_RISE_JOINED_AFTER`.
|
|
75
|
+
* SPPA's NHS Circular 2025/09 (SA-61) keeps it across opting out and
|
|
76
|
+
* rejoining (Annex A Q9), and a later period's date would tell a
|
|
77
|
+
* long-serving member 57, so this reads their FIRST joining.
|
|
78
|
+
* - **When they draw.** Only for a member the rise reaches, and only before it
|
|
79
|
+
* takes effect: until 6 April 2028 the law's minimum is still 55.
|
|
80
|
+
*/
|
|
81
|
+
export declare function memberMinimumPensionAge(history: JoiningHistory, drawing: IsoDate): number;
|
|
82
|
+
/**
|
|
83
|
+
* Whether a member may draw their pension on `drawing`, other than through
|
|
84
|
+
* ill health: on or after the birthday at which they reach their minimum
|
|
85
|
+
* pension age on that day. An age is reached on the birthday, as `npaDate`
|
|
86
|
+
* counts it. A caller walking the ages asks it of each drawing day.
|
|
87
|
+
*/
|
|
88
|
+
export declare function mayDrawOn(history: JoiningHistory, drawing: IsoDate): boolean;
|
|
89
|
+
/** A member's minimum pension age on a drawing day, and whether they have
|
|
90
|
+
* reached it by then. */
|
|
91
|
+
interface DrawingTest {
|
|
92
|
+
readonly minimumAge: number;
|
|
93
|
+
readonly mayDraw: boolean;
|
|
94
|
+
}
|
|
95
|
+
/** The one place the minimum pension age is applied to a drawing: both
|
|
96
|
+
* answers at once, for a caller that refuses a drawing and names the age. */
|
|
97
|
+
export declare function drawingTest({ born, firstJoined }: JoiningHistory, drawing: IsoDate): DrawingTest;
|
|
98
|
+
/** The first day of a member's earliest period: the joining the minimum
|
|
99
|
+
* pension age reads. */
|
|
100
|
+
export declare function firstJoinedOf(member: {
|
|
101
|
+
readonly service: readonly {
|
|
102
|
+
readonly joined: IsoDate;
|
|
103
|
+
}[];
|
|
104
|
+
}): IsoDate;
|
|
105
|
+
export {};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ages a member's NHS pension turns on: each section's pension age, the
|
|
3
|
+
* 2015 Section's from their date of birth, and the earliest age they can choose
|
|
4
|
+
* to draw, from when they first joined and when they draw.
|
|
5
|
+
*
|
|
6
|
+
* NORMAL PENSION AGE in the 2015 Section = the member's State Pension age, with
|
|
7
|
+
* a floor of 65 (NHSBSA 2015 Members' Guide V13, May 2024, archived as SA-38 in
|
|
8
|
+
* docs/source-archive.md). The SPA timetable is legislated — Pensions Acts
|
|
9
|
+
* 1995/2007/2011/2014 — and reproduced in DWP's "State Pension age timetables",
|
|
10
|
+
* archived as SA-62 in docs/source-archive.md (last updated 15 May 2014; the
|
|
11
|
+
* legislated dates have not changed since — the 2023 SPA review left them as
|
|
12
|
+
* enacted).
|
|
13
|
+
*
|
|
14
|
+
* Whole years only. The Acts phase each rise through narrow transitional birth
|
|
15
|
+
* cohorts whose exact SPA is 65/66/67 plus some months; `normalPensionAge`
|
|
16
|
+
* returns the NEXT whole year for those cohorts (66/67/68). Rounding up is
|
|
17
|
+
* member-conservative, in the same spirit as the ERF part-month round-up (GAD
|
|
18
|
+
* 2019 guidance §2.3): a projection anchored on the later NPA can understate
|
|
19
|
+
* early-retirement pension by a few months' factor, never overstate it. Callers
|
|
20
|
+
* needing month-exact SPA for the transitional cohorts need the per-cohort tables
|
|
21
|
+
* in the Acts, which this library deliberately does not transcribe.
|
|
22
|
+
*
|
|
23
|
+
* MINIMUM PENSION AGE: who the law's rise reaches, and what everyone else
|
|
24
|
+
* keeps. The rule, its source and what it leaves out are in
|
|
25
|
+
* docs/how-it-works.md#minimum-pension-age.
|
|
26
|
+
*/
|
|
27
|
+
import { minimumPensionAgeFor, protectedPensionAgeCutoff, } from '@casomoltd/paye-calc';
|
|
28
|
+
import { dayBefore, earliest, npaDate } from '../dates.js';
|
|
29
|
+
import { invariant } from '../errors.js';
|
|
30
|
+
import { isoDate, isoDateOf, isoToDate } from '../iso-date.js';
|
|
31
|
+
/**
|
|
32
|
+
* The fixed pension ages the legacy sections' factors are measured from,
|
|
33
|
+
* named for the section that sets each: DHSC_PETITION_779519, archived as SA-59
|
|
34
|
+
* in docs/source-archive.md, states "The Normal Pension Age in the NHS Pension
|
|
35
|
+
* Scheme is 60 in the 1995 Section, 65 in the 2008 Section". The factor tables
|
|
36
|
+
* are keyed by pension age, and these are the only two a legacy benefit has;
|
|
37
|
+
* the 2015 Section's is the member's own normal pension age.
|
|
38
|
+
*/
|
|
39
|
+
export const LEGACY_PENSION_AGES = {
|
|
40
|
+
section1995: 60,
|
|
41
|
+
section2008: 65,
|
|
42
|
+
};
|
|
43
|
+
/** The age from which the scheme gave every member a right to draw: 55 at
|
|
44
|
+
* the latest, in the 1995 and 2008 Sections and the 2015 Section alike.
|
|
45
|
+
* DHSC's petition response (DHSC_PETITION_779519, archived as SA-59 in
|
|
46
|
+
* docs/source-archive.md) and SPPA's NHS Circular 2025/09 (SA-61) say so.
|
|
47
|
+
* It is the right paye-calc's `minimumPensionAgeFor` protects through the
|
|
48
|
+
* 2028 rise, and so the age an earlier joiner keeps. A lower age kept from
|
|
49
|
+
* 2006 or 2010 is not modelled; what that costs is in
|
|
50
|
+
* docs/how-it-works.md#minimum-pension-age. */
|
|
51
|
+
export const MPA_KEPT_AGE = 55;
|
|
52
|
+
/** The last day a member can have first joined and hold that right
|
|
53
|
+
* immediately before paye-calc's `protectedPensionAgeCutoff()`: the day
|
|
54
|
+
* before it. For a caller to show; the rule itself compares against the
|
|
55
|
+
* cut-off. */
|
|
56
|
+
export const MPA_RISE_JOINED_AFTER = isoDateOf(dayBefore(protectedPensionAgeCutoff()));
|
|
57
|
+
/**
|
|
58
|
+
* 2015 Section floor (Members' Guide V13). Everyone born before
|
|
59
|
+
* the first band below has SPA ≤ 65 (women's pre-equalisation
|
|
60
|
+
* SPA was lower still), so the floor is their NPA.
|
|
61
|
+
*/
|
|
62
|
+
const NPA_FLOOR = 65;
|
|
63
|
+
/**
|
|
64
|
+
* Each band starts where the timetable first exceeds the
|
|
65
|
+
* previous whole year; the value is that rise's target age.
|
|
66
|
+
* Boundaries are dates of birth from gov.uk's timetable:
|
|
67
|
+
* - 6 Dec 1953 — first cohort with SPA above 65
|
|
68
|
+
* (Pensions Act 2011; phased to 6 Oct 1954, then exactly 66)
|
|
69
|
+
* - 6 Apr 1960 — first cohort above 66, "66 years and 1 month"
|
|
70
|
+
* (Pensions Act 2014; phased to 5 Mar 1961, then exactly 67)
|
|
71
|
+
* - 6 Apr 1977 — first cohort above 67
|
|
72
|
+
* (Pensions Act 2007; phased to 5 Apr 1978, then exactly 68)
|
|
73
|
+
*/
|
|
74
|
+
const SPA_BANDS = [
|
|
75
|
+
{ from: isoToDate(isoDate('1953-12-06')), npa: 66 },
|
|
76
|
+
{ from: isoToDate(isoDate('1960-04-06')), npa: 67 },
|
|
77
|
+
{ from: isoToDate(isoDate('1977-04-06')), npa: 68 },
|
|
78
|
+
];
|
|
79
|
+
/**
|
|
80
|
+
* Normal pension age for a 2015 Section member born on
|
|
81
|
+
* `dateOfBirth`, in whole years (see the module header for the
|
|
82
|
+
* transitional-cohort rounding).
|
|
83
|
+
*/
|
|
84
|
+
export function normalPensionAge(dateOfBirth) {
|
|
85
|
+
invariant(!Number.isNaN(dateOfBirth.getTime()), 'normalPensionAge: invalid dateOfBirth');
|
|
86
|
+
let npa = NPA_FLOOR;
|
|
87
|
+
for (const band of SPA_BANDS) {
|
|
88
|
+
if (dateOfBirth >= band.from)
|
|
89
|
+
npa = band.npa;
|
|
90
|
+
}
|
|
91
|
+
return npa;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The earliest age a member can choose to draw a pension on `drawing`, other
|
|
95
|
+
* than through ill health. It depends on two dates:
|
|
96
|
+
*
|
|
97
|
+
* - **When they first joined.** The law (Finance Act 2004 Sch 36 para 23ZB,
|
|
98
|
+
* through paye-calc's `minimumPensionAgeFor`) keeps a protected pension age
|
|
99
|
+
* for a member who held a right to draw before 57 immediately before its
|
|
100
|
+
* cut-off. The scheme gave every member that right from 55
|
|
101
|
+
* (`MPA_KEPT_AGE`), so this is anyone in it by `MPA_RISE_JOINED_AFTER`.
|
|
102
|
+
* SPPA's NHS Circular 2025/09 (SA-61) keeps it across opting out and
|
|
103
|
+
* rejoining (Annex A Q9), and a later period's date would tell a
|
|
104
|
+
* long-serving member 57, so this reads their FIRST joining.
|
|
105
|
+
* - **When they draw.** Only for a member the rise reaches, and only before it
|
|
106
|
+
* takes effect: until 6 April 2028 the law's minimum is still 55.
|
|
107
|
+
*/
|
|
108
|
+
export function memberMinimumPensionAge(history, drawing) {
|
|
109
|
+
return drawingTest(history, drawing).minimumAge;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Whether a member may draw their pension on `drawing`, other than through
|
|
113
|
+
* ill health: on or after the birthday at which they reach their minimum
|
|
114
|
+
* pension age on that day. An age is reached on the birthday, as `npaDate`
|
|
115
|
+
* counts it. A caller walking the ages asks it of each drawing day.
|
|
116
|
+
*/
|
|
117
|
+
export function mayDrawOn(history, drawing) {
|
|
118
|
+
return drawingTest(history, drawing).mayDraw;
|
|
119
|
+
}
|
|
120
|
+
/** The one place the minimum pension age is applied to a drawing: both
|
|
121
|
+
* answers at once, for a caller that refuses a drawing and names the age. */
|
|
122
|
+
export function drawingTest({ born, firstJoined }, drawing) {
|
|
123
|
+
const on = isoToDate(drawing);
|
|
124
|
+
const minimumAge = minimumPensionAgeFor({
|
|
125
|
+
rightFromAge: MPA_KEPT_AGE,
|
|
126
|
+
heldBeforeCutoff: isoToDate(firstJoined) < protectedPensionAgeCutoff(),
|
|
127
|
+
}, on);
|
|
128
|
+
return { minimumAge, mayDraw: on >= npaDate(isoToDate(born), minimumAge) };
|
|
129
|
+
}
|
|
130
|
+
/** The first day of a member's earliest period: the joining the minimum
|
|
131
|
+
* pension age reads. */
|
|
132
|
+
export function firstJoinedOf(member) {
|
|
133
|
+
if (member.service.length === 0) {
|
|
134
|
+
throw new RangeError('member: no service declared');
|
|
135
|
+
}
|
|
136
|
+
return isoDateOf(earliest(...member.service.map((p) => isoToDate(p.joined))));
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=ages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ages.js","sourceRoot":"","sources":["../../src/pension/ages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EACL,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAC,MAAM,aAAa,CAAC;AACzD,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAG7D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,WAAW,EAAE,EAAE;IACf,WAAW,EAAE,EAAE;CACP,CAAC;AAEX;;;;;;;gDAOgD;AAChD,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAE/B;;;eAGe;AACf,MAAM,C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ACnC,OAAgB;IAEhB,MAAM,EAAE,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAC9B,MAAM,UAAU,GAAG,oBAAoB,CAAC;QACtC,YAAY,EAAE,YAAY;QAC1B,gBAAgB,EAAE,SAAS,CAAC,WAAW,CAAC,GAAG,yBAAyB,EAAE;KACvE,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,EAAC,UAAU,EAAE,OAAO,EAAE,EAAE,IAAI,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC,EAAC,CAAC;AAC3E,CAAC;AAED;yBACyB;AACzB,MAAM,UAAU,aAAa,CAC3B,MAAiE;IAEjE,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,UAAU,CAAC,6BAA6B,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,SAAS,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC"}
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import { npaDate } from '../dates.js';
|
|
6
6
|
import { bestSingleOf3, PAY_MEASURES } from './final-salary.js';
|
|
7
7
|
import { BenefitNotModelled, NOT_MODELLED } from '../errors.js';
|
|
8
|
-
import { FACTOR_APPLIES, FACTOR_DIRECTIONS, FACTOR_SOURCES,
|
|
8
|
+
import { FACTOR_APPLIES, FACTOR_DIRECTIONS, FACTOR_SOURCES, readFactor, } from '../factor-basis.js';
|
|
9
|
+
import { LEGACY_PENSION_AGES } from '../pension/ages.js';
|
|
9
10
|
/** The pension age the 1995 Section's reductions are measured from. */
|
|
10
11
|
const PENSION_AGE = LEGACY_PENSION_AGES.section1995;
|
|
11
12
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section-1995.js","sourceRoot":"","sources":["../../src/sections/section-1995.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAC;AACpC,OAAO,EAAC,aAAa,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAC,kBAAkB,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAC9D,OAAO,EACL,cAAc,EAAE,iBAAiB,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"section-1995.js","sourceRoot":"","sources":["../../src/sections/section-1995.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAC;AACpC,OAAO,EAAC,aAAa,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAC,kBAAkB,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAC9D,OAAO,EACL,cAAc,EAAE,iBAAiB,EAAE,cAAc,EAAE,UAAU,GAC9D,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAC,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AAKvD,uEAAuE;AACvE,MAAM,WAAW,GAAG,mBAAmB,CAAC,WAAW,CAAC;AAEpD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,UAAU,CACxB,WAAiB,EACjB,OAAa,EACb,KAAW,EACX,OAAoB;IAEpB,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAChD,IAAI,KAAK,GAAG,KAAK,EAAE,CAAC;QAClB,OAAO,EAAC,MAAM,EAAE,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC,EAAC,CAAC;IAC1D,CAAC;IACD,IAAI,KAAK,GAAG,KAAK,IAAI,OAAO,GAAG,KAAK,EAAE,CAAC;QACrC,MAAM,IAAI,kBAAkB,CAC1B,YAAY,CAAC,mBAAmB,EAChC,gEAAgE,CACjE,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,GAAgB;QACzB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,iBAAiB,CAAC,KAAK,EAAE,OAAO;KAClE,CAAC;IACF,OAAO,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC;AAED;;0BAE0B;AAC1B,MAAM,CAAC,MAAM,UAAU,GAAqB;IAC1C,WAAW,EAAE,EAAE;IACf,UAAU,EAAE,YAAY,CAAC,aAAa;IACtC,UAAU,EAAE,WAAW;IACvB,UAAU,EAAE,KAAK;IACjB,QAAQ,EAAE,aAAa;IACvB,aAAa,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAC7C,UAAU,CAAC,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC;IACjE,gBAAgB,EAAE;QAChB,QAAQ,EAAE,CAAC;QACX,MAAM,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CACtC,UAAU,CAAC,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC;KAClE;CACF,CAAC"}
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
import { npaDate } from '../dates.js';
|
|
7
7
|
import { meanOf3ConsecutiveIn10, PAY_MEASURES } from './final-salary.js';
|
|
8
8
|
import { BenefitNotModelled, NOT_MODELLED } from '../errors.js';
|
|
9
|
-
import { FACTOR_DIRECTIONS,
|
|
9
|
+
import { FACTOR_DIRECTIONS, readFactor } from '../factor-basis.js';
|
|
10
|
+
import { LEGACY_PENSION_AGES } from '../pension/ages.js';
|
|
10
11
|
/** The pension age the 2008 Section's factors are measured from. */
|
|
11
12
|
const PENSION_AGE = LEGACY_PENSION_AGES.section2008;
|
|
12
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section-2008.js","sourceRoot":"","sources":["../../src/sections/section-2008.ts"],"names":[],"mappings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AAC/C,CAAC;AAED;;6BAE6B;AAC7B,MAAM,CAAC,MAAM,UAAU,GAAqB;IAC1C,WAAW,EAAE,EAAE;IACf,UAAU,EAAE,YAAY,CAAC,sBAAsB;IAC/C,UAAU,EAAE,WAAW;IACvB,UAAU,EAAE,IAAI;IAChB,QAAQ,EAAE,sBAAsB;IAChC,aAAa,EAAE,UAAU;IACzB,gBAAgB,EAAE,IAAI;CACvB,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { npaDate } from '../dates.js';
|
|
7
7
|
import { FACTOR_APPLIES, FACTOR_DIRECTIONS, FACTOR_SOURCES, MEMBERS_NPA, readFactor, } from '../factor-basis.js';
|
|
8
|
-
import { normalPensionAge } from '../
|
|
8
|
+
import { normalPensionAge } from '../pension/ages.js';
|
|
9
9
|
import { atDrawing, buildLedger } from '../pension/ledger.js';
|
|
10
10
|
/**
|
|
11
11
|
* The factor for a benefit determined under the 2015 Section's rules,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section-2015.js","sourceRoot":"","sources":["../../src/sections/section-2015.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,cAAc,EAAE,iBAAiB,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,GAC3E,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAC,gBAAgB,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"section-2015.js","sourceRoot":"","sources":["../../src/sections/section-2015.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,cAAc,EAAE,iBAAiB,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,GAC3E,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAC,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EAAE,MAAM;QACpB,GAAG,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC;KAC7C,CAAC;AACJ,CAAC"}
|
package/dist/sources.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* allowance — so a second copy of its url or issue date is a second
|
|
8
8
|
* copy that can fall out of step with the first.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
10
|
+
* Five kinds live here and the difference is load-bearing:
|
|
11
11
|
*
|
|
12
12
|
* - **Award instruments** — what a nation ACCEPTED. A written
|
|
13
13
|
* ministerial statement, a gov.scot news page, a Welsh written
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
* - **Scale circulars** — what PUBLISHES the salary figures. Prints a
|
|
16
16
|
* pay table, often no percentage at all.
|
|
17
17
|
* - **Allowance letters** — what sets a cash allowance per session.
|
|
18
|
+
* - **Scheme statements** — what an issuer says of a scheme: a factsheet,
|
|
19
|
+
* or a government response, which says so where it cites no instrument.
|
|
20
|
+
* - **Legislation** — an Act's own provision, where the rule a figure
|
|
21
|
+
* turns on is the statute's rather than the scheme's.
|
|
18
22
|
*
|
|
19
23
|
* They diverge in every nation. England's 2026-27 medical award was
|
|
20
24
|
* enacted by HCWS1462 on parliament.uk while its salaries are printed
|
|
@@ -103,7 +107,7 @@ export declare const AFC_W_02_2026: DocumentSource;
|
|
|
103
107
|
* Wales applies to its lowest spine points.
|
|
104
108
|
*
|
|
105
109
|
* A LETTER that sets an allowance, not a circular that publishes a
|
|
106
|
-
* ladder — the third of `DocumentSource`'s
|
|
110
|
+
* ladder — the third of `DocumentSource`'s kinds. It carries
|
|
107
111
|
* the hourly floor in its Action paragraph and the annual floor in
|
|
108
112
|
* its own spine-point table, and neither derives from the other, so
|
|
109
113
|
* both are transcribed from it in `scales.ts`.
|
|
@@ -195,6 +199,19 @@ export declare const MD_W_01_2025: DocumentSource;
|
|
|
195
199
|
* source and expect an answer.
|
|
196
200
|
*/
|
|
197
201
|
export declare const HSC_TC8_05_2025: DocumentSource;
|
|
202
|
+
/** DHSC on who the 2028 rise in the minimum age reaches; archived as SA-59 in
|
|
203
|
+
* docs/source-archive.md. A petition response that cites no instrument. */
|
|
204
|
+
export declare const DHSC_PETITION_779519: DocumentSource;
|
|
205
|
+
/** The Scottish scheme's own statement of who keeps 55; archived as SA-61 in
|
|
206
|
+
* docs/source-archive.md, the version with paragraph 9 updated. */
|
|
207
|
+
export declare const SPPA_NHS_CIRCULAR_2025_09: DocumentSource;
|
|
198
208
|
/** The additional pension limit and unit; archived as SA-58 in
|
|
199
209
|
* docs/source-archive.md. */
|
|
200
210
|
export declare const AP_FACTSHEET_2026: DocumentSource;
|
|
211
|
+
/** The protected pension age kept through the 2028 rise in the minimum age:
|
|
212
|
+
* Finance Act 2004 Sch 36 para 23ZB, inserted by Finance Act 2022 s.10(5)
|
|
213
|
+
* (Royal Assent 24 February 2022); archived as SA-60 in docs/source-archive.md.
|
|
214
|
+
* paye-calc's `minimumPensionAgeFor` models the rule, and
|
|
215
|
+
* `memberMinimumPensionAge` applies it to the scheme's right from 55. Held
|
|
216
|
+
* here because paye-calc keeps no source records. */
|
|
217
|
+
export declare const FA2004_SCH36_PARA_23ZB: DocumentSource;
|