@casomoltd/nhs-pay 0.24.2 → 0.26.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 +5 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/post.d.ts +10 -1
- package/dist/post.js +17 -2
- package/dist/post.js.map +1 -1
- package/dist/scales.d.ts +14 -32
- package/dist/scales.js +18 -37
- package/dist/scales.js.map +1 -1
- package/dist/take-home.d.ts +16 -1
- package/dist/take-home.js +41 -22
- package/dist/take-home.js.map +1 -1
- package/dist/working-week.d.ts +43 -0
- package/dist/working-week.js +70 -0
- package/dist/working-week.js.map +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -523,7 +523,11 @@ nation's or year's figures.
|
|
|
523
523
|
|
|
524
524
|
## Test fixtures
|
|
525
525
|
|
|
526
|
-
`tests/
|
|
526
|
+
`tests/working-week.test.ts` pins the AfC week and its 365/7 year
|
|
527
|
+
against every hourly rate Scotland's circular prints beside a salary, and
|
|
528
|
+
the Welsh living-wage pair.
|
|
529
|
+
|
|
530
|
+
`tests/fixtures/band-take-home.csv` — golden-value rows
|
|
527
531
|
covering bands 5, 7, 8a across all 4 nations (England,
|
|
528
532
|
Scotland, Wales, NI), both tax years, 3 HCAS zones, and
|
|
529
533
|
part-time (0.6 FTE). Gross figures are derived from
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { afcBand1 } from './afc-scales.js';
|
|
2
2
|
export type { AfcBand1, AfcBand1Published } from './afc-scales.js';
|
|
3
|
-
export { AFC_BANDS, AFC_BAND_IDS,
|
|
3
|
+
export { AFC_BANDS, AFC_BAND_IDS, afcScaleSource, latestAfcYear, payYearLag, isAwaitingPayAward, assertPayYearLagIsSane, afcPayYears, NLW_HOURLY, WALES_LIVING_WAGE, annualiseHourly, } from './scales.js';
|
|
4
4
|
export type { AfcBandId, HcasZone, HcasZones, WalesLivingWage, } from './scales.js';
|
|
5
5
|
export type { ScalePoint } from './scale-point.js';
|
|
6
6
|
export { PensionTiers, getEmployerPensionRate, getPensionScheme, getPensionTiers, getPensionTiersVO, lookupPensionTier, pensionTierRate, } from './pension.js';
|
|
@@ -71,8 +71,9 @@ export { AFC_REGIONS, ZONE_TO_REGION, afcRegionToHcasZone, afcRegionToNation, is
|
|
|
71
71
|
export type { AfcRegionId, ResolvedRegion, } from './regions.js';
|
|
72
72
|
export { AFC_CURRENT_YEAR, AFC_PREVIOUS_YEAR, getAfcScales, } from './bands.js';
|
|
73
73
|
export type { AfcBandMeta, AfcScaleData, } from './bands.js';
|
|
74
|
-
export { nhsTakeHome } from './take-home.js';
|
|
74
|
+
export { nhsAnnualAllowance, nhsTakeHome } from './take-home.js';
|
|
75
|
+
export { afcWeekInForce, afcWeeklyHours, hoursPerYear } from './working-week.js';
|
|
75
76
|
export type { NhsTakeHomeOptions } from './take-home.js';
|
|
76
77
|
export { fmtMoney, fmtPct, fmtSalary, formatGBP, formatGBPPrecise, formatPct, formatPctPrecise, yearLabel, } from './format.js';
|
|
77
|
-
export { TAX_REGIONS, TAX_YEARS, NATIONS, NATION_KEYS, TakeHomePay, GrossAnnual, PensionBasis, PensionPercent, StudentLoanPlan, nationToTaxRegion, getTaxYearConfig,
|
|
78
|
+
export { TAX_REGIONS, TAX_YEARS, NATIONS, NATION_KEYS, TakeHomePay, GrossAnnual, PensionBasis, PensionPercent, StudentLoanPlan, nationToTaxRegion, getTaxYearConfig, } from '@casomoltd/paye-calc';
|
|
78
79
|
export type { Nation, TaxRegion, TaxYear, PayYear, YearLabel, } from '@casomoltd/paye-calc';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// ── Scales ───────────────────────────────────────
|
|
2
2
|
export { afcBand1 } from './afc-scales.js';
|
|
3
|
-
export { AFC_BANDS, AFC_BAND_IDS,
|
|
3
|
+
export { AFC_BANDS, AFC_BAND_IDS, afcScaleSource, latestAfcYear, payYearLag, isAwaitingPayAward, assertPayYearLagIsSane, afcPayYears, NLW_HOURLY, WALES_LIVING_WAGE, annualiseHourly, } from './scales.js';
|
|
4
4
|
// ── Pension ──────────────────────────────────────
|
|
5
5
|
export { PensionTiers, getEmployerPensionRate, getPensionScheme, getPensionTiers, getPensionTiersVO, lookupPensionTier, pensionTierRate, } from './pension.js';
|
|
6
6
|
// ── Post & resolvers ─────────────────────────────
|
|
@@ -74,11 +74,13 @@ export { AFC_REGIONS, ZONE_TO_REGION, afcRegionToHcasZone, afcRegionToNation, is
|
|
|
74
74
|
// ── Bands ────────────────────────────────────────
|
|
75
75
|
export { AFC_CURRENT_YEAR, AFC_PREVIOUS_YEAR, getAfcScales, } from './bands.js';
|
|
76
76
|
// ── Take-home ────────────────────────────────────
|
|
77
|
-
export { nhsTakeHome } from './take-home.js';
|
|
77
|
+
export { nhsAnnualAllowance, nhsTakeHome } from './take-home.js';
|
|
78
|
+
// ── Working week ──────────────────────────────
|
|
79
|
+
export { afcWeekInForce, afcWeeklyHours, hoursPerYear } from './working-week.js';
|
|
78
80
|
// ── Format ───────────────────────────────────────
|
|
79
81
|
export { fmtMoney, fmtPct, fmtSalary, formatGBP, formatGBPPrecise, formatPct, formatPctPrecise, yearLabel, } from './format.js';
|
|
80
82
|
// ── Re-exports from paye-calc ────────────────────
|
|
81
83
|
// Types that appear in our public API so consumers
|
|
82
84
|
// don't need a direct paye-calc import for NHS work.
|
|
83
|
-
export { TAX_REGIONS, TAX_YEARS, NATIONS, NATION_KEYS, TakeHomePay, GrossAnnual, PensionBasis, PensionPercent, StudentLoanPlan, nationToTaxRegion, getTaxYearConfig,
|
|
85
|
+
export { TAX_REGIONS, TAX_YEARS, NATIONS, NATION_KEYS, TakeHomePay, GrossAnnual, PensionBasis, PensionPercent, StudentLoanPlan, nationToTaxRegion, getTaxYearConfig, } from '@casomoltd/paye-calc';
|
|
84
86
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EACL,SAAS,EACT,YAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EACL,SAAS,EACT,YAAY,EACZ,cAAc,EACd,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,eAAe,GAChB,MAAM,aAAa,CAAC;AASrB,oDAAoD;AACpD,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,GAChB,MAAM,cAAc,CAAC;AAUtB,oDAAoD;AACpD,OAAO,EAAC,IAAI,EAAE,cAAc,EAAC,MAAM,WAAW,CAAC;AAU/C,OAAO,EAAC,WAAW,EAAE,cAAc,EAAE,eAAe,EAAC,MAAM,eAAe,CAAC;AAS3E,oDAAoD;AACpD,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAK5B,oDAAoD;AACpD,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AAKjC,OAAO,EAAC,yBAAyB,EAAC,MAAM,mCAAmC,CAAC;AAK5E,oDAAoD;AACpD,OAAO,EACL,2BAA2B,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ACb,MAAM,WAAW,CAAC;AAGnB,oDAAoD;AACpD,OAAO,EACL,WAAW,EACX,WAAW,GACZ,MAAM,gBAAgB,CAAC;AAGxB,oDAAoD;AACpD,OAAO,EACL,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,QAAQ,EACR,aAAa,GACd,MAAM,cAAc,CAAC;AAMtB,oDAAoD;AACpD,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,GACb,MAAM,YAAY,CAAC;AAMpB,oDAAoD;AACpD,OAAO,EAAC,kBAAkB,EAAE,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE/D,iDAAiD;AACjD,OAAO,EAAC,cAAc,EAAE,cAAc,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAG/E,oDAAoD;AACpD,OAAO,EACL,QAAQ,EACR,MAAM,EACN,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,SAAS,GACV,MAAM,aAAa,CAAC;AAErB,oDAAoD;AACpD,mDAAmD;AACnD,qDAAqD;AACrD,OAAO,EACL,WAAW,EACX,SAAS,EACT,OAAO,EACP,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,EACZ,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,sBAAsB,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, StudentLoanPlan, TaxCode } from '@casomoltd/paye-calc';
|
|
13
|
+
import type { Nation, PayYear, TaxYear, TakeHomePay, AnnualAllowance, 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';
|
|
@@ -201,8 +201,17 @@ export declare class Post {
|
|
|
201
201
|
* never drift from what paye-calc actually deducts.
|
|
202
202
|
*/
|
|
203
203
|
get pensionContribution(): number;
|
|
204
|
+
/** The contribution rate as a fraction, as the take-home reads it;
|
|
205
|
+
* `pensionRate` is per cent. */
|
|
206
|
+
private get _pensionFraction();
|
|
204
207
|
/** Full take-home breakdown (tax, NI, pension, net). */
|
|
205
208
|
get takeHome(): TakeHomePay;
|
|
209
|
+
/**
|
|
210
|
+
* The pension annual allowance this post's year meets, with the
|
|
211
|
+
* scheme's defined-benefit pension input: read it here, not off
|
|
212
|
+
* `takeHome`, whose own allowance has no scheme input.
|
|
213
|
+
*/
|
|
214
|
+
get annualAllowance(): AnnualAllowance;
|
|
206
215
|
/** Annual income tax (£). */
|
|
207
216
|
get tax(): number;
|
|
208
217
|
/** 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 { nhsTakeHome } from './take-home.js';
|
|
15
|
+
import { nhsAnnualAllowance, 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';
|
|
@@ -48,6 +48,8 @@ export const NO_ADJUSTMENTS = {
|
|
|
48
48
|
taxCode: null,
|
|
49
49
|
pensionOptedOut: false,
|
|
50
50
|
};
|
|
51
|
+
/** `pensionRate` is per cent. */
|
|
52
|
+
const PER_CENT = 100;
|
|
51
53
|
export class Post {
|
|
52
54
|
identity;
|
|
53
55
|
salary;
|
|
@@ -193,13 +195,26 @@ export class Post {
|
|
|
193
195
|
get pensionContribution() {
|
|
194
196
|
return this.takeHome.pensionDeduction;
|
|
195
197
|
}
|
|
198
|
+
/** The contribution rate as a fraction, as the take-home reads it;
|
|
199
|
+
* `pensionRate` is per cent. */
|
|
200
|
+
get _pensionFraction() {
|
|
201
|
+
return this.pensionRate / PER_CENT;
|
|
202
|
+
}
|
|
196
203
|
/** Full take-home breakdown (tax, NI, pension, net). */
|
|
197
204
|
get takeHome() {
|
|
198
|
-
return nhsTakeHome(this.pensionablePay, this.
|
|
205
|
+
return nhsTakeHome(this.pensionablePay, this._pensionFraction, this.identity.taxYear, nationToTaxRegion(this.identity.nation), {
|
|
199
206
|
studentLoans: this.adjustments.studentLoans,
|
|
200
207
|
taxCode: this.adjustments.taxCode,
|
|
201
208
|
});
|
|
202
209
|
}
|
|
210
|
+
/**
|
|
211
|
+
* The pension annual allowance this post's year meets, with the
|
|
212
|
+
* scheme's defined-benefit pension input: read it here, not off
|
|
213
|
+
* `takeHome`, whose own allowance has no scheme input.
|
|
214
|
+
*/
|
|
215
|
+
get annualAllowance() {
|
|
216
|
+
return nhsAnnualAllowance(this.pensionablePay, this._pensionFraction, this.identity.taxYear, nationToTaxRegion(this.identity.nation));
|
|
217
|
+
}
|
|
203
218
|
/** Annual income tax (£). */
|
|
204
219
|
get tax() {
|
|
205
220
|
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;AAUvD,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAC,kBAAkB,EAAE,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE/D,OAAO,EAAC,SAAS,EAAC,M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}
|
package/dist/scales.d.ts
CHANGED
|
@@ -74,33 +74,16 @@ interface AfcScaleYear {
|
|
|
74
74
|
scales: Record<AfcBandId, SteppedPoint[]>;
|
|
75
75
|
}
|
|
76
76
|
export declare const NLW_HOURLY: Partial<Record<YearLabel, number>>;
|
|
77
|
-
/**
|
|
78
|
-
* Standard AfC working hours per year (37.5 × 365/7 ≈ 1,955.4).
|
|
79
|
-
*
|
|
80
|
-
* The week-year is 365/7, not 52, matching every publisher that prints
|
|
81
|
-
* an hourly rate beside an annual salary, and matching NHS Employers'
|
|
82
|
-
* own ~1,955.4-hour year. A 52-week year gives 1,950, which no
|
|
83
|
-
* publisher prints.
|
|
84
|
-
*
|
|
85
|
-
* @deprecated Use `hoursPerYear(config)` from
|
|
86
|
-
* paye-calc for region-aware hours. This constant
|
|
87
|
-
* assumes rUK 37.5h weeks and is wrong for Scotland
|
|
88
|
-
* from 2026-27.
|
|
89
|
-
*/
|
|
90
|
-
export declare const AFC_HOURS_PER_YEAR: number;
|
|
91
77
|
/**
|
|
92
78
|
* Annualise an hourly rate at given weekly hours.
|
|
93
79
|
*
|
|
94
|
-
* `weeklyHours` is required: the standard week
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* Scottish rate. Pass `config.standardWeeklyHours`.
|
|
80
|
+
* `weeklyHours` is required: the standard week varies by
|
|
81
|
+
* nation and year (`afcWeeklyHours`), so defaulting it
|
|
82
|
+
* would silently return an rUK answer for a Scottish rate.
|
|
83
|
+
* Pass `afcWeeklyHours(year, nation)`.
|
|
99
84
|
*
|
|
100
|
-
* The
|
|
101
|
-
*
|
|
102
|
-
* divisor that disagreed would round-trip a salary to a
|
|
103
|
-
* different number.
|
|
85
|
+
* The inverse of dividing by `hoursPerYear`, which it reads, so the two
|
|
86
|
+
* agree up to the rounding of the hourly rate and of the result.
|
|
104
87
|
*/
|
|
105
88
|
export declare function annualiseHourly(hourly: number, weeklyHours: number): number;
|
|
106
89
|
/** The Welsh living-wage floor for a year, as its pay
|
|
@@ -150,14 +133,14 @@ export declare function afcPayYears(nation: Nation): PayYear[];
|
|
|
150
133
|
*
|
|
151
134
|
* A person's salary comes from an Agenda for Change round; the tax, NI
|
|
152
135
|
* and pension tiers applied to it come from the tax year they are
|
|
153
|
-
* being paid IN. Those are different facts
|
|
154
|
-
* same year
|
|
155
|
-
*
|
|
136
|
+
* being paid IN. Those are different facts that normally name the
|
|
137
|
+
* same year, so one value serving both looks right until the day they
|
|
138
|
+
* diverge.
|
|
156
139
|
*
|
|
157
140
|
* They diverge in exactly one way. An AfC round is agreed and
|
|
158
141
|
* implemented by each nation separately, and a nation whose award is
|
|
159
|
-
* not yet funded keeps paying last year's scales into this tax year
|
|
160
|
-
*
|
|
142
|
+
* not yet funded keeps paying last year's scales into this tax year;
|
|
143
|
+
* this function says which nations are. Tax never waits: the thresholds
|
|
161
144
|
* change on 6 April whatever the employer has settled.
|
|
162
145
|
*
|
|
163
146
|
* So the legitimate values are:
|
|
@@ -172,10 +155,9 @@ export declare function afcPayYears(nation: Nation): PayYear[];
|
|
|
172
155
|
* the world: a lag of 2 means a whole round was never transcribed.
|
|
173
156
|
* {@link assertPayYearLagIsSane} is where that is enforced.
|
|
174
157
|
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
* Only distinct types would stop that.
|
|
158
|
+
* What this cannot catch is a pay year passed where a tax year was
|
|
159
|
+
* wanted: the values here would look perfectly legal. The distinct
|
|
160
|
+
* `PayYear` and `TaxYear` types are what stop that.
|
|
179
161
|
*/
|
|
180
162
|
export declare function payYearLag(nation: Nation): number;
|
|
181
163
|
/**
|
package/dist/scales.js
CHANGED
|
@@ -58,6 +58,7 @@ import { ScaleUnavailable, invariant } from './errors.js';
|
|
|
58
58
|
import { AFC_ENGLAND_SCALES_2025, AFC_ENGLAND_SCALES_2026, AFC_NI_2025, AFC_SCOTLAND, AFC_W_02_2025, AFC_W_02_2026, } from './sources.js';
|
|
59
59
|
import { NI_SCALES_2025_26, SCOTLAND_SCALES_2025_26, SCOTLAND_SCALES_2026_27, WALES_SCALES_2025_26, WALES_SCALES_2026_27, } from './afc-scales.js';
|
|
60
60
|
import { afcPoint } from './afc-scales.js';
|
|
61
|
+
import { hoursPerYear } from './working-week.js';
|
|
61
62
|
// The band registry lives in its own module so the translation layer
|
|
62
63
|
// can name a band without importing this one — see `afc-band.ts`.
|
|
63
64
|
export { AFC_BANDS, AFC_BAND_IDS } from './afc-band.js';
|
|
@@ -103,7 +104,7 @@ const AFC_SCALES_2025_26 = {
|
|
|
103
104
|
// and the wage floor has compressed the two to the same cash
|
|
104
105
|
// figure — so the structure is published and the equality is
|
|
105
106
|
// the fact, not a reason to collapse it. Wales's Band 2 is the
|
|
106
|
-
// same shape and
|
|
107
|
+
// same shape and is modelled the same way.
|
|
107
108
|
'2': [
|
|
108
109
|
afcPoint(1, false, 24465),
|
|
109
110
|
afcPoint(3, true, 24465),
|
|
@@ -167,7 +168,7 @@ const AFC_SCALES_2026_27 = {
|
|
|
167
168
|
// and the wage floor has compressed the two to the same cash
|
|
168
169
|
// figure — so the structure is published and the equality is
|
|
169
170
|
// the fact, not a reason to collapse it. Wales's Band 2 is the
|
|
170
|
-
// same shape and
|
|
171
|
+
// same shape and is modelled the same way.
|
|
171
172
|
'2': [
|
|
172
173
|
afcPoint(1, false, 25272),
|
|
173
174
|
afcPoint(3, true, 25272),
|
|
@@ -306,38 +307,19 @@ export const NLW_HOURLY = {
|
|
|
306
307
|
[TAX_YEARS.Y2025_26]: 12.21,
|
|
307
308
|
[TAX_YEARS.Y2026_27]: 12.71,
|
|
308
309
|
};
|
|
309
|
-
/** Standard rUK AfC weekly hours (Scotland differs from 2026-27). */
|
|
310
|
-
const RUK_WEEKLY_HOURS = 37.5;
|
|
311
|
-
/**
|
|
312
|
-
* Standard AfC working hours per year (37.5 × 365/7 ≈ 1,955.4).
|
|
313
|
-
*
|
|
314
|
-
* The week-year is 365/7, not 52, matching every publisher that prints
|
|
315
|
-
* an hourly rate beside an annual salary, and matching NHS Employers'
|
|
316
|
-
* own ~1,955.4-hour year. A 52-week year gives 1,950, which no
|
|
317
|
-
* publisher prints.
|
|
318
|
-
*
|
|
319
|
-
* @deprecated Use `hoursPerYear(config)` from
|
|
320
|
-
* paye-calc for region-aware hours. This constant
|
|
321
|
-
* assumes rUK 37.5h weeks and is wrong for Scotland
|
|
322
|
-
* from 2026-27.
|
|
323
|
-
*/
|
|
324
|
-
export const AFC_HOURS_PER_YEAR = (RUK_WEEKLY_HOURS * 365) / 7;
|
|
325
310
|
/**
|
|
326
311
|
* Annualise an hourly rate at given weekly hours.
|
|
327
312
|
*
|
|
328
|
-
* `weeklyHours` is required: the standard week
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
* Scottish rate. Pass `config.standardWeeklyHours`.
|
|
313
|
+
* `weeklyHours` is required: the standard week varies by
|
|
314
|
+
* nation and year (`afcWeeklyHours`), so defaulting it
|
|
315
|
+
* would silently return an rUK answer for a Scottish rate.
|
|
316
|
+
* Pass `afcWeeklyHours(year, nation)`.
|
|
333
317
|
*
|
|
334
|
-
* The
|
|
335
|
-
*
|
|
336
|
-
* divisor that disagreed would round-trip a salary to a
|
|
337
|
-
* different number.
|
|
318
|
+
* The inverse of dividing by `hoursPerYear`, which it reads, so the two
|
|
319
|
+
* agree up to the rounding of the hourly rate and of the result.
|
|
338
320
|
*/
|
|
339
321
|
export function annualiseHourly(hourly, weeklyHours) {
|
|
340
|
-
return Math.round(
|
|
322
|
+
return Math.round(hourly * hoursPerYear(weeklyHours));
|
|
341
323
|
}
|
|
342
324
|
export const WALES_LIVING_WAGE = {
|
|
343
325
|
[TAX_YEARS.Y2026_27]: { annual: 26300, hourly: 13.45 },
|
|
@@ -504,14 +486,14 @@ export function afcPayYears(nation) {
|
|
|
504
486
|
*
|
|
505
487
|
* A person's salary comes from an Agenda for Change round; the tax, NI
|
|
506
488
|
* and pension tiers applied to it come from the tax year they are
|
|
507
|
-
* being paid IN. Those are different facts
|
|
508
|
-
* same year
|
|
509
|
-
*
|
|
489
|
+
* being paid IN. Those are different facts that normally name the
|
|
490
|
+
* same year, so one value serving both looks right until the day they
|
|
491
|
+
* diverge.
|
|
510
492
|
*
|
|
511
493
|
* They diverge in exactly one way. An AfC round is agreed and
|
|
512
494
|
* implemented by each nation separately, and a nation whose award is
|
|
513
|
-
* not yet funded keeps paying last year's scales into this tax year
|
|
514
|
-
*
|
|
495
|
+
* not yet funded keeps paying last year's scales into this tax year;
|
|
496
|
+
* this function says which nations are. Tax never waits: the thresholds
|
|
515
497
|
* change on 6 April whatever the employer has settled.
|
|
516
498
|
*
|
|
517
499
|
* So the legitimate values are:
|
|
@@ -526,10 +508,9 @@ export function afcPayYears(nation) {
|
|
|
526
508
|
* the world: a lag of 2 means a whole round was never transcribed.
|
|
527
509
|
* {@link assertPayYearLagIsSane} is where that is enforced.
|
|
528
510
|
*
|
|
529
|
-
*
|
|
530
|
-
*
|
|
531
|
-
*
|
|
532
|
-
* Only distinct types would stop that.
|
|
511
|
+
* What this cannot catch is a pay year passed where a tax year was
|
|
512
|
+
* wanted: the values here would look perfectly legal. The distinct
|
|
513
|
+
* `PayYear` and `TaxYear` types are what stop that.
|
|
533
514
|
*/
|
|
534
515
|
export function payYearLag(nation) {
|
|
535
516
|
const order = Object.values(TAX_YEARS);
|
package/dist/scales.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scales.js","sourceRoot":"","sources":["../src/scales.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAKH,OAAO,EACL,WAAW,EACX,SAAS,EACT,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAC,gBAAgB,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AAExD,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,WAAW,EACX,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K,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACvC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,+DAA+D;QAC/D,+DAA+D;QAC/D,kEAAkE;QAClE,iBAAiB;QACjB,MAAM,IAAI,KAAK,CACb,kBAAkB,MAAM,qCAAqC,CAC9D,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;uDAQuD;AACvD,MAAM,UAAU,gBAAgB,CAC9B,IAAa,EACb,MAAc;IAEd,MAAM,GAAG,GAAc,IAAI,CAAC;IAC5B,MAAM,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/take-home.d.ts
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* library only selects the basis.
|
|
21
21
|
*/
|
|
22
22
|
import { TakeHomePay } from '@casomoltd/paye-calc';
|
|
23
|
-
import type { TaxYear, TaxRegion, StudentLoanPlan, TaxCode } from '@casomoltd/paye-calc';
|
|
23
|
+
import type { AnnualAllowance, TaxYear, TaxRegion, StudentLoanPlan, TaxCode } from '@casomoltd/paye-calc';
|
|
24
24
|
/**
|
|
25
25
|
* Generic PAYE deductions layered on the NHS salary — the paye-calc
|
|
26
26
|
* inputs a bare scale salary doesn't carry. Each is optional and
|
|
@@ -34,6 +34,10 @@ export interface NhsTakeHomeOptions {
|
|
|
34
34
|
readonly taxCode?: TaxCode | null;
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
|
+
* The take-home pay of an NHS post. Its `annualAllowance()` has no
|
|
38
|
+
* scheme pension input; read the allowance through
|
|
39
|
+
* `nhsAnnualAllowance` (or `Post.annualAllowance`).
|
|
40
|
+
*
|
|
37
41
|
* @param salary Gross annual pay assessed for tax/NI (already
|
|
38
42
|
* FTE-adjusted and net of any salary sacrifice)
|
|
39
43
|
* @param pensionRate Decimal fraction (e.g. 0.098); 0 = opted out
|
|
@@ -43,3 +47,14 @@ export interface NhsTakeHomeOptions {
|
|
|
43
47
|
* @param options Student loans / tax-code override
|
|
44
48
|
*/
|
|
45
49
|
export declare function nhsTakeHome(salary: number, pensionRate: number, taxYear: TaxYear, taxRegion: TaxRegion, options?: NhsTakeHomeOptions): TakeHomePay;
|
|
50
|
+
/**
|
|
51
|
+
* The pension annual allowance an NHS member's year meets. The scheme
|
|
52
|
+
* is defined benefit, so the pension input is the growth in CARE
|
|
53
|
+
* benefits (paye-calc's DB multiple of the year's accrual), not the
|
|
54
|
+
* contribution paid;
|
|
55
|
+
* without it adjusted income omits the scheme and the taper never
|
|
56
|
+
* bites for high earners. An opted-out member (rate 0) has no input.
|
|
57
|
+
* Source: HMRC PTM053301 (DB pension input amount), the citation
|
|
58
|
+
* paye-calc's `DB_PENSION_INPUT_MULTIPLIER` carries.
|
|
59
|
+
*/
|
|
60
|
+
export declare function nhsAnnualAllowance(salary: number, pensionRate: number, taxYear: TaxYear, taxRegion: TaxRegion): AnnualAllowance;
|
package/dist/take-home.js
CHANGED
|
@@ -19,10 +19,16 @@
|
|
|
19
19
|
* rule to state and to cite: casomoltd/paye-calc#29. This
|
|
20
20
|
* library only selects the basis.
|
|
21
21
|
*/
|
|
22
|
-
import { TakeHomePay, GrossAnnual, PensionBasis, PensionPercent, } from '@casomoltd/paye-calc';
|
|
22
|
+
import { TakeHomePay, GrossAnnual, NO_PENSION, PensionBasis, PensionPercent, getTaxYearConfig, payAt, } from '@casomoltd/paye-calc';
|
|
23
23
|
import { yearlyAccrual } from './pension-projection.js';
|
|
24
24
|
import { invariant } from './errors.js';
|
|
25
|
+
/** A rate is a fraction here; paye-calc takes a pension per cent. */
|
|
26
|
+
const PER_CENT = 100;
|
|
25
27
|
/**
|
|
28
|
+
* The take-home pay of an NHS post. Its `annualAllowance()` has no
|
|
29
|
+
* scheme pension input; read the allowance through
|
|
30
|
+
* `nhsAnnualAllowance` (or `Post.annualAllowance`).
|
|
31
|
+
*
|
|
26
32
|
* @param salary Gross annual pay assessed for tax/NI (already
|
|
27
33
|
* FTE-adjusted and net of any salary sacrifice)
|
|
28
34
|
* @param pensionRate Decimal fraction (e.g. 0.098); 0 = opted out
|
|
@@ -35,25 +41,17 @@ export function nhsTakeHome(salary, pensionRate, taxYear, taxRegion, options = {
|
|
|
35
41
|
const thp = new TakeHomePay(taxYear, taxRegion);
|
|
36
42
|
thp.setSalary(GrossAnnual(salary));
|
|
37
43
|
// A positive rate is scheme membership (NET arrangement); zero is an
|
|
38
|
-
// opted-out member, so there's no pension
|
|
44
|
+
// opted-out member, so there's no pension at all — never a 0%
|
|
39
45
|
// Employer contribution.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
// Source: HMRC PTM044230 (pension input amount for DB schemes).
|
|
48
|
-
thp.setDbAnnualAccrual(yearlyAccrual(salary));
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
thp.setPensionBasis(PensionBasis.None);
|
|
52
|
-
}
|
|
53
|
-
// setStudentLoanPlans wants a mutable Set; the VO holds a
|
|
54
|
-
// ReadonlySet, so copy it at the boundary.
|
|
46
|
+
const isMember = pensionRate > 0;
|
|
47
|
+
thp.setPension(isMember
|
|
48
|
+
? {
|
|
49
|
+
basis: PensionBasis.Employer,
|
|
50
|
+
contribution: PensionPercent(pensionRate * PER_CENT),
|
|
51
|
+
}
|
|
52
|
+
: NO_PENSION);
|
|
55
53
|
if (options.studentLoans && options.studentLoans.size > 0) {
|
|
56
|
-
thp.setStudentLoanPlans(
|
|
54
|
+
thp.setStudentLoanPlans(options.studentLoans);
|
|
57
55
|
}
|
|
58
56
|
if (options.taxCode) {
|
|
59
57
|
thp.setTaxCode(options.taxCode);
|
|
@@ -63,14 +61,35 @@ export function nhsTakeHome(salary, pensionRate, taxYear, taxRegion, options = {
|
|
|
63
61
|
// ever changes when the pension is applied, the pension basis is
|
|
64
62
|
// wrong or paye-calc's model changed — fail loud here (this runs in
|
|
65
63
|
// every test and page) rather than silently overstating take-home.
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
if (isMember) {
|
|
65
|
+
// The same inputs but the pension, so the pension alone is what
|
|
66
|
+
// the two sides differ by.
|
|
67
|
+
const inputs = {
|
|
68
|
+
config: getTaxYearConfig(taxYear, taxRegion),
|
|
69
|
+
pension: thp.pension,
|
|
70
|
+
studentLoans: thp.studentLoanPlans,
|
|
71
|
+
taxCode: options.taxCode ?? null,
|
|
72
|
+
};
|
|
73
|
+
invariant(payAt(salary, inputs).niBreakdown.total
|
|
74
|
+
=== payAt(salary, { ...inputs, pension: NO_PENSION }).niBreakdown.total, 'NHS pension is a net-pay arrangement: it must reduce income '
|
|
70
75
|
+ 'tax but not National Insurance (NI is assessed on full '
|
|
71
76
|
+ 'gross). NI changed when the pension was applied. '
|
|
72
77
|
+ 'See HMRC PTM044230.');
|
|
73
78
|
}
|
|
74
79
|
return thp;
|
|
75
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* The pension annual allowance an NHS member's year meets. The scheme
|
|
83
|
+
* is defined benefit, so the pension input is the growth in CARE
|
|
84
|
+
* benefits (paye-calc's DB multiple of the year's accrual), not the
|
|
85
|
+
* contribution paid;
|
|
86
|
+
* without it adjusted income omits the scheme and the taper never
|
|
87
|
+
* bites for high earners. An opted-out member (rate 0) has no input.
|
|
88
|
+
* Source: HMRC PTM053301 (DB pension input amount), the citation
|
|
89
|
+
* paye-calc's `DB_PENSION_INPUT_MULTIPLIER` carries.
|
|
90
|
+
*/
|
|
91
|
+
export function nhsAnnualAllowance(salary, pensionRate, taxYear, taxRegion) {
|
|
92
|
+
const isMember = pensionRate > 0;
|
|
93
|
+
return nhsTakeHome(salary, pensionRate, taxYear, taxRegion).annualAllowance(isMember ? { dbAnnualAccrual: yearlyAccrual(salary) } : {});
|
|
94
|
+
}
|
|
76
95
|
//# sourceMappingURL=take-home.js.map
|
package/dist/take-home.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"take-home.js","sourceRoot":"","sources":["../src/take-home.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EACL,WAAW,EACX,WAAW,EACX,YAAY,EACZ,cAAc,
|
|
1
|
+
{"version":3,"file":"take-home.js","sourceRoot":"","sources":["../src/take-home.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EACL,WAAW,EACX,WAAW,EACX,UAAU,EACV,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,KAAK,GACN,MAAM,sBAAsB,CAAC;AAQ9B,OAAO,EAAC,aAAa,EAAC,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,qEAAqE;AACrE,MAAM,QAAQ,GAAG,GAAG,CAAC;AAerB;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CACzB,MAAc,EACd,WAAmB,EACnB,OAAgB,EAChB,SAAoB,EACpB,UAA8B,EAAE;IAEhC,MAAM,GAAG,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAChD,GAAG,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;IACnC,qEAAqE;IACrE,8DAA8D;IAC9D,yBAAyB;IACzB,MAAM,QAAQ,GAAG,WAAW,GAAG,CAAC,CAAC;IACjC,GAAG,CAAC,UAAU,CAAC,QAAQ;QACrB,CAAC,CAAC;YACA,KAAK,EAAE,YAAY,CAAC,QAAQ;YAC5B,YAAY,EAAE,cAAc,CAAC,WAAW,GAAG,QAAQ,CAAC;SACrD;QACD,CAAC,CAAC,UAAU,C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AAM,CAAC,EAAC,CAAC,CAAC,CAAC,EAAE,CACzD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Agenda for Change full-time week, by nation and pay year, and the
|
|
3
|
+
* hours in a year it gives. An hourly rate is an annual salary over these
|
|
4
|
+
* hours, so a Scottish rate read at the rest of the UK's week comes out
|
|
5
|
+
* low by the difference.
|
|
6
|
+
*
|
|
7
|
+
* Sources, by figure:
|
|
8
|
+
* - 37.5 hours, England, Wales and Northern Ireland: "NHS Terms and
|
|
9
|
+
* Conditions of Service Handbook, amendment 62" (#sa-41). The section
|
|
10
|
+
* setting the week has not been re-read for this module.
|
|
11
|
+
* - Scotland, 37 hours in 2025-26: "Scotland, PCS(AFC)2026/1" (#sa-13),
|
|
12
|
+
* Annex B p8, whose hourly rates are printed "Based on a 37 Hour Week".
|
|
13
|
+
* - Scotland, 36 hours from 1 April 2026: the same circular's 2026-27
|
|
14
|
+
* Annex B prints its rates on a 36-hour week, the week
|
|
15
|
+
* `AFC_SCOTLAND_36_HOUR_WEEK` (PCS(AFC)2026/2, in `sources.ts`) sets.
|
|
16
|
+
* Scotland's week before 2025-26 has no archived source, so those years
|
|
17
|
+
* throw rather than serve a figure nobody has checked.
|
|
18
|
+
* See docs/source-archive.md.
|
|
19
|
+
*/
|
|
20
|
+
import type { Nation, PayYear, TaxYear } from '@casomoltd/paye-calc';
|
|
21
|
+
/**
|
|
22
|
+
* The full-time AfC week a pay round's scale is built on: the week its
|
|
23
|
+
* circular divides by. A member paid on last year's round is on last
|
|
24
|
+
* year's week.
|
|
25
|
+
*/
|
|
26
|
+
export declare function afcWeeklyHours(year: PayYear, nation: Nation): number;
|
|
27
|
+
/**
|
|
28
|
+
* The full-time AfC week in force in a tax year, whatever round a nation
|
|
29
|
+
* is paying on: a week changes on 1 April, by the calendar, as Scotland's
|
|
30
|
+
* 36 hours did in 2026. It differs from `afcWeeklyHours` only for a
|
|
31
|
+
* nation still paying an earlier round.
|
|
32
|
+
*/
|
|
33
|
+
export declare function afcWeekInForce(year: TaxYear, nation: Nation): number;
|
|
34
|
+
/**
|
|
35
|
+
* Hours in a year at a given week: the divisor for an hourly rate.
|
|
36
|
+
*
|
|
37
|
+
* Not 52 weeks. A year is 52 weeks and a day, and the circulars this
|
|
38
|
+
* library pins (Scotland's PCS(AFC)2026/1 and the Welsh living-wage
|
|
39
|
+
* letter) divide by the longer year; 52 would give a rate neither
|
|
40
|
+
* prints, about 0.3% high. Leap years are ignored, as those tables
|
|
41
|
+
* ignore them. `tests/working-week.test.ts` pins it.
|
|
42
|
+
*/
|
|
43
|
+
export declare function hoursPerYear(weeklyHours: number): number;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Agenda for Change full-time week, by nation and pay year, and the
|
|
3
|
+
* hours in a year it gives. An hourly rate is an annual salary over these
|
|
4
|
+
* hours, so a Scottish rate read at the rest of the UK's week comes out
|
|
5
|
+
* low by the difference.
|
|
6
|
+
*
|
|
7
|
+
* Sources, by figure:
|
|
8
|
+
* - 37.5 hours, England, Wales and Northern Ireland: "NHS Terms and
|
|
9
|
+
* Conditions of Service Handbook, amendment 62" (#sa-41). The section
|
|
10
|
+
* setting the week has not been re-read for this module.
|
|
11
|
+
* - Scotland, 37 hours in 2025-26: "Scotland, PCS(AFC)2026/1" (#sa-13),
|
|
12
|
+
* Annex B p8, whose hourly rates are printed "Based on a 37 Hour Week".
|
|
13
|
+
* - Scotland, 36 hours from 1 April 2026: the same circular's 2026-27
|
|
14
|
+
* Annex B prints its rates on a 36-hour week, the week
|
|
15
|
+
* `AFC_SCOTLAND_36_HOUR_WEEK` (PCS(AFC)2026/2, in `sources.ts`) sets.
|
|
16
|
+
* Scotland's week before 2025-26 has no archived source, so those years
|
|
17
|
+
* throw rather than serve a figure nobody has checked.
|
|
18
|
+
* See docs/source-archive.md.
|
|
19
|
+
*/
|
|
20
|
+
import { NATION_KEYS } from '@casomoltd/paye-calc';
|
|
21
|
+
/** The week everywhere but Scotland, every year this library covers. */
|
|
22
|
+
const FULL_TIME_WEEK = 37.5;
|
|
23
|
+
/** Scotland's week, for the years a circular sets it. */
|
|
24
|
+
const SCOTLAND_WEEK = {
|
|
25
|
+
'2025-26': 37,
|
|
26
|
+
'2026-27': 36,
|
|
27
|
+
};
|
|
28
|
+
// A year of weeks as payroll counts it: 365 days over 7.
|
|
29
|
+
const DAYS_PER_YEAR = 365;
|
|
30
|
+
const DAYS_PER_WEEK = 7;
|
|
31
|
+
/**
|
|
32
|
+
* The full-time AfC week a pay round's scale is built on: the week its
|
|
33
|
+
* circular divides by. A member paid on last year's round is on last
|
|
34
|
+
* year's week.
|
|
35
|
+
*/
|
|
36
|
+
export function afcWeeklyHours(year, nation) {
|
|
37
|
+
return weekFor(year, nation);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The full-time AfC week in force in a tax year, whatever round a nation
|
|
41
|
+
* is paying on: a week changes on 1 April, by the calendar, as Scotland's
|
|
42
|
+
* 36 hours did in 2026. It differs from `afcWeeklyHours` only for a
|
|
43
|
+
* nation still paying an earlier round.
|
|
44
|
+
*/
|
|
45
|
+
export function afcWeekInForce(year, nation) {
|
|
46
|
+
return weekFor(year, nation);
|
|
47
|
+
}
|
|
48
|
+
/** The week for a year's label, whichever question asks it. */
|
|
49
|
+
function weekFor(label, nation) {
|
|
50
|
+
if (nation !== NATION_KEYS.scotland)
|
|
51
|
+
return FULL_TIME_WEEK;
|
|
52
|
+
const week = SCOTLAND_WEEK[label];
|
|
53
|
+
if (week === undefined) {
|
|
54
|
+
throw new RangeError(`No sourced AfC week for Scotland in ${label}`);
|
|
55
|
+
}
|
|
56
|
+
return week;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Hours in a year at a given week: the divisor for an hourly rate.
|
|
60
|
+
*
|
|
61
|
+
* Not 52 weeks. A year is 52 weeks and a day, and the circulars this
|
|
62
|
+
* library pins (Scotland's PCS(AFC)2026/1 and the Welsh living-wage
|
|
63
|
+
* letter) divide by the longer year; 52 would give a rate neither
|
|
64
|
+
* prints, about 0.3% high. Leap years are ignored, as those tables
|
|
65
|
+
* ignore them. `tests/working-week.test.ts` pins it.
|
|
66
|
+
*/
|
|
67
|
+
export function hoursPerYear(weeklyHours) {
|
|
68
|
+
return (weeklyHours * DAYS_PER_YEAR) / DAYS_PER_WEEK;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=working-week.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"working-week.js","sourceRoot":"","sources":["../src/working-week.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAC,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAGjD,wEAAwE;AACxE,MAAM,cAAc,GAAG,IAAI,CAAC;AAE5B,yDAAyD;AACzD,MAAM,aAAa,GAAuC;IACxD,SAAS,EAAE,EAAE;IACb,SAAS,EAAE,EAAE;CACd,CAAC;AAEF,yDAAyD;AACzD,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,IAAa,EAAE,MAAc;IAC1D,OAAO,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,IAAa,EAAE,MAAc;IAC1D,OAAO,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC/B,CAAC;AAED,+DAA+D;AAC/D,SAAS,OAAO,CAAC,KAAgB,EAAE,MAAc;IAC/C,IAAI,MAAM,KAAK,WAAW,CAAC,QAAQ;QAAE,OAAO,cAAc,CAAC;IAC3D,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IAClC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,IAAI,UAAU,CAClB,uCAAuC,KAAK,EAAE,CAC/C,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,WAAmB;IAC9C,OAAO,CAAC,WAAW,GAAG,aAAa,CAAC,GAAG,aAAa,CAAC;AACvD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@casomoltd/nhs-pay",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"description": "NHS pay scales and take-home pay, and a member's NHS pension across the 1995, 2008 and 2015 Sections",
|
|
5
5
|
"homepage": "https://casomo.co.uk",
|
|
6
6
|
"bugs": "https://github.com/casomoltd/nhs-pay/issues",
|
|
@@ -67,10 +67,10 @@
|
|
|
67
67
|
"provenance": true
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@casomoltd/paye-calc": ">=0.
|
|
70
|
+
"@casomoltd/paye-calc": ">=0.10.0"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@casomoltd/paye-calc": "^0.
|
|
73
|
+
"@casomoltd/paye-calc": "^0.10.0",
|
|
74
74
|
"@casomoltd/tooling": "^0.37.0",
|
|
75
75
|
"@commitlint/cli": "^20.0.0",
|
|
76
76
|
"@js-temporal/polyfill": "^0.5.1",
|