@equisoft/tax-ca 2026.9.0 → 2026.9.1

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.
@@ -11,8 +11,8 @@ Revised
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.CPP = void 0;
14
- const date_1 = require("../utils/date");
15
14
  const math_1 = require("../utils/math");
15
+ const public_pension_plan_1 = require("./public-pension-plan");
16
16
  exports.CPP = {
17
17
  PENSIONABLE_EARNINGS: {
18
18
  BASIC_EXEMPTION: 3500,
@@ -146,31 +146,7 @@ exports.CPP = {
146
146
  },
147
147
  YEARS_TO_FULL_PENSION: 40,
148
148
  getRequestDateFactor(birthDate, requestDate, customReferenceDate) {
149
- const { BONUS, PENALTY } = this.MONTHLY_DELAY;
150
- const minRequestDate = (0, date_1.addYearsToDate)(birthDate, this.MIN_REQUEST_AGE);
151
- const maxRequestDate = (0, date_1.addYearsToDate)(birthDate, this.MAX_REQUEST_AGE);
152
- const referenceDate = customReferenceDate || (0, date_1.addYearsToDate)(birthDate, this.DEFAULT_REFERENCE_AGE);
153
- const monthsToToday = (0, date_1.getMonthsDiff)(birthDate, (0, date_1.now)());
154
- const monthsToMinRequestDate = (0, date_1.getMonthsDiff)(birthDate, minRequestDate);
155
- const monthsToMaxRequestDate = (0, date_1.getMonthsDiff)(birthDate, maxRequestDate);
156
- const monthsToReferenceDate = (0, date_1.getMonthsDiff)(birthDate, referenceDate);
157
- const monthsToRequestDate = (0, date_1.getMonthsDiff)(birthDate, requestDate);
158
- const monthsToLastBirthDay = monthsToToday - (monthsToToday % 12);
159
- // Request date is before minimum request date
160
- if (monthsToRequestDate < monthsToMinRequestDate) {
161
- return 0;
162
- }
163
- // Analysis date is after the maximum request date
164
- if (monthsToMaxRequestDate < monthsToToday) {
165
- return 1;
166
- }
167
- // Analysis date is after reference date and request date is before last birthday
168
- if (monthsToToday > monthsToReferenceDate && monthsToRequestDate < monthsToLastBirthDay) {
169
- return 1;
170
- }
171
- let monthsDelta = (0, math_1.clamp)(monthsToRequestDate, monthsToMinRequestDate, monthsToMaxRequestDate);
172
- monthsDelta -= Math.max(monthsToLastBirthDay, monthsToReferenceDate);
173
- return 1 + (monthsDelta * (monthsDelta >= 0 ? BONUS : PENALTY));
149
+ return (0, public_pension_plan_1.getPublicPensionRequestDateFactor)(this, birthDate, requestDate, customReferenceDate);
174
150
  },
175
151
  getAverageIndexationRate() {
176
152
  const sum = this.INDEXATION_RATE_REFERENCES.reduce((previous, current) => previous + current[1], 0);
@@ -61,3 +61,15 @@ export interface PublicPensionPlan {
61
61
  getRequestDateFactor(birthDate: Date, requestDate: Date, customReferenceDate?: Date): number;
62
62
  getAverageIndexationRate(): number;
63
63
  }
64
+ /**
65
+ * Deferral/penalty factor applied to a CPP/QPP retirement pension, anchored at the reference age
66
+ * (65 by default, or `customReferenceDate`).
67
+ *
68
+ * The factor is a pure function of the birth date and the request date: it does not depend on the
69
+ * current date. For each month the request is deferred past the reference age it adds
70
+ * `MONTHLY_DELAY.BONUS` (up to `MAX_REQUEST_AGE`); for each month before the reference age it removes
71
+ * `MONTHLY_DELAY.PENALTY` (down to `MIN_REQUEST_AGE`).
72
+ *
73
+ * Returns 0 when the request date is before the minimum request age.
74
+ */
75
+ export declare function getPublicPensionRequestDateFactor(plan: PublicPensionPlan, birthDate: Date, requestDate: Date, customReferenceDate?: Date): number;
@@ -1,2 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPublicPensionRequestDateFactor = getPublicPensionRequestDateFactor;
4
+ const date_1 = require("../utils/date");
5
+ const math_1 = require("../utils/math");
6
+ /**
7
+ * Deferral/penalty factor applied to a CPP/QPP retirement pension, anchored at the reference age
8
+ * (65 by default, or `customReferenceDate`).
9
+ *
10
+ * The factor is a pure function of the birth date and the request date: it does not depend on the
11
+ * current date. For each month the request is deferred past the reference age it adds
12
+ * `MONTHLY_DELAY.BONUS` (up to `MAX_REQUEST_AGE`); for each month before the reference age it removes
13
+ * `MONTHLY_DELAY.PENALTY` (down to `MIN_REQUEST_AGE`).
14
+ *
15
+ * Returns 0 when the request date is before the minimum request age.
16
+ */
17
+ function getPublicPensionRequestDateFactor(plan, birthDate, requestDate, customReferenceDate) {
18
+ const { BONUS, PENALTY } = plan.MONTHLY_DELAY;
19
+ const minRequestDate = (0, date_1.addYearsToDate)(birthDate, plan.MIN_REQUEST_AGE);
20
+ const maxRequestDate = (0, date_1.addYearsToDate)(birthDate, plan.MAX_REQUEST_AGE);
21
+ const referenceDate = customReferenceDate || (0, date_1.addYearsToDate)(birthDate, plan.DEFAULT_REFERENCE_AGE);
22
+ const monthsToMinRequestDate = (0, date_1.getMonthsDiff)(birthDate, minRequestDate);
23
+ const monthsToMaxRequestDate = (0, date_1.getMonthsDiff)(birthDate, maxRequestDate);
24
+ const monthsToReferenceDate = (0, date_1.getMonthsDiff)(birthDate, referenceDate);
25
+ const monthsToRequestDate = (0, date_1.getMonthsDiff)(birthDate, requestDate);
26
+ // Request date is before the minimum request date
27
+ if (monthsToRequestDate < monthsToMinRequestDate) {
28
+ return 0;
29
+ }
30
+ const monthsDelta = (0, math_1.clamp)(monthsToRequestDate, monthsToMinRequestDate, monthsToMaxRequestDate)
31
+ - monthsToReferenceDate;
32
+ return 1 + (monthsDelta * (monthsDelta >= 0 ? BONUS : PENALTY));
33
+ }
@@ -8,8 +8,8 @@ Revised
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.QPP = void 0;
11
- const date_1 = require("../utils/date");
12
11
  const math_1 = require("../utils/math");
12
+ const public_pension_plan_1 = require("./public-pension-plan");
13
13
  exports.QPP = {
14
14
  PENSIONABLE_EARNINGS: {
15
15
  BASIC_EXEMPTION: 3500,
@@ -145,31 +145,7 @@ exports.QPP = {
145
145
  },
146
146
  YEARS_TO_FULL_PENSION: 40,
147
147
  getRequestDateFactor(birthDate, requestDate, customReferenceDate) {
148
- const { BONUS, PENALTY } = this.MONTHLY_DELAY;
149
- const minRequestDate = (0, date_1.addYearsToDate)(birthDate, this.MIN_REQUEST_AGE);
150
- const maxRequestDate = (0, date_1.addYearsToDate)(birthDate, this.MAX_REQUEST_AGE);
151
- const referenceDate = customReferenceDate || (0, date_1.addYearsToDate)(birthDate, this.DEFAULT_REFERENCE_AGE);
152
- const monthsToToday = (0, date_1.getMonthsDiff)(birthDate, (0, date_1.now)());
153
- const monthsToMinRequestDate = (0, date_1.getMonthsDiff)(birthDate, minRequestDate);
154
- const monthsToMaxRequestDate = (0, date_1.getMonthsDiff)(birthDate, maxRequestDate);
155
- const monthsToReferenceDate = (0, date_1.getMonthsDiff)(birthDate, referenceDate);
156
- const monthsToRequestDate = (0, date_1.getMonthsDiff)(birthDate, requestDate);
157
- const monthsToLastBirthDay = monthsToToday - (monthsToToday % 12);
158
- // Request date is before minimum request date
159
- if (monthsToRequestDate < monthsToMinRequestDate) {
160
- return 0;
161
- }
162
- // Analysis date is after the maximum request date
163
- if (monthsToMaxRequestDate < monthsToToday) {
164
- return 1;
165
- }
166
- // Analysis date is after reference date and request date is before last birthday
167
- if (monthsToToday > monthsToReferenceDate && monthsToRequestDate < monthsToLastBirthDay) {
168
- return 1;
169
- }
170
- let monthsDelta = (0, math_1.clamp)(monthsToRequestDate, monthsToMinRequestDate, monthsToMaxRequestDate);
171
- monthsDelta -= Math.max(monthsToLastBirthDay, monthsToReferenceDate);
172
- return 1 + (monthsDelta * (monthsDelta >= 0 ? BONUS : PENALTY));
148
+ return (0, public_pension_plan_1.getPublicPensionRequestDateFactor)(this, birthDate, requestDate, customReferenceDate);
173
149
  },
174
150
  getAverageIndexationRate() {
175
151
  const sum = this.INDEXATION_RATE_REFERENCES.reduce((previous, current) => previous + current[1], 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equisoft/tax-ca",
3
- "version": "2026.9.0",
3
+ "version": "2026.9.1",
4
4
  "description": "Canadian tax data and calculation functions.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",