@equisoft/tax-ca 2022.0.0 → 2022.0.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.
@@ -187,15 +187,15 @@ function getMaxWithdrawalPct(jurisdiction, age) {
187
187
  case 'NB':
188
188
  case 'NL':
189
189
  case 'SK':
190
- return exports.province1MaxWithdrawalPct[utils_1.clamp(age, 54, 90)];
190
+ return exports.province1MaxWithdrawalPct[(0, utils_1.clamp)(age, 54, 90)];
191
191
  case 'QC':
192
192
  case 'MB':
193
193
  case 'NS':
194
- return exports.province2MaxWithdrawalPct[utils_1.clamp(age, 54, 89)];
194
+ return exports.province2MaxWithdrawalPct[(0, utils_1.clamp)(age, 54, 89)];
195
195
  case 'CA':
196
- return exports.federalMaxWithdrawalPct[utils_1.clamp(age, 54, 89)];
196
+ return exports.federalMaxWithdrawalPct[(0, utils_1.clamp)(age, 54, 89)];
197
197
  default:
198
- return exports.othersMaxWithdrawalPct[utils_1.clamp(age, 54, 96)];
198
+ return exports.othersMaxWithdrawalPct[(0, utils_1.clamp)(age, 54, 96)];
199
199
  }
200
200
  }
201
201
  exports.getMaxWithdrawalPct = getMaxWithdrawalPct;
@@ -57,14 +57,14 @@ exports.CPP = {
57
57
  },
58
58
  getRequestDateFactor(birthDate, requestDate, customReferenceDate) {
59
59
  const { BONUS, PENALTY } = this.MONTHLY_DELAY;
60
- const minRequestDate = date_1.addYearsToDate(birthDate, this.MIN_REQUEST_AGE);
61
- const maxRequestDate = date_1.addYearsToDate(birthDate, this.MAX_REQUEST_AGE);
62
- const referenceDate = customReferenceDate || date_1.addYearsToDate(birthDate, this.DEFAULT_REFERENCE_AGE);
63
- const monthsToToday = date_1.getMonthsDiff(birthDate, date_1.now());
64
- const monthsToMinRequestDate = date_1.getMonthsDiff(birthDate, minRequestDate);
65
- const monthsToMaxRequestDate = date_1.getMonthsDiff(birthDate, maxRequestDate);
66
- const monthsToReferenceDate = date_1.getMonthsDiff(birthDate, referenceDate);
67
- const monthsToRequestDate = date_1.getMonthsDiff(birthDate, requestDate);
60
+ const minRequestDate = (0, date_1.addYearsToDate)(birthDate, this.MIN_REQUEST_AGE);
61
+ const maxRequestDate = (0, date_1.addYearsToDate)(birthDate, this.MAX_REQUEST_AGE);
62
+ const referenceDate = customReferenceDate || (0, date_1.addYearsToDate)(birthDate, this.DEFAULT_REFERENCE_AGE);
63
+ const monthsToToday = (0, date_1.getMonthsDiff)(birthDate, (0, date_1.now)());
64
+ const monthsToMinRequestDate = (0, date_1.getMonthsDiff)(birthDate, minRequestDate);
65
+ const monthsToMaxRequestDate = (0, date_1.getMonthsDiff)(birthDate, maxRequestDate);
66
+ const monthsToReferenceDate = (0, date_1.getMonthsDiff)(birthDate, referenceDate);
67
+ const monthsToRequestDate = (0, date_1.getMonthsDiff)(birthDate, requestDate);
68
68
  const monthsToLastBirthDay = monthsToToday - (monthsToToday % 12);
69
69
  // Request date is before minimum request date
70
70
  if (monthsToRequestDate < monthsToMinRequestDate) {
@@ -78,13 +78,13 @@ exports.CPP = {
78
78
  if (monthsToToday > monthsToReferenceDate && monthsToRequestDate < monthsToLastBirthDay) {
79
79
  return 1;
80
80
  }
81
- let monthsDelta = math_1.clamp(monthsToRequestDate, monthsToMinRequestDate, monthsToMaxRequestDate);
81
+ let monthsDelta = (0, math_1.clamp)(monthsToRequestDate, monthsToMinRequestDate, monthsToMaxRequestDate);
82
82
  monthsDelta -= Math.max(monthsToLastBirthDay, monthsToReferenceDate);
83
83
  return 1 + monthsDelta * (monthsDelta >= 0 ? BONUS : PENALTY);
84
84
  },
85
85
  getAverageIndexationRate() {
86
86
  const sum = this.INDEXATION_RATE_REFERENCES.reduce((previous, current) => previous + current[1], 0);
87
- return math_1.roundToPrecision(sum / this.INDEXATION_RATE_REFERENCES.length, 3);
87
+ return (0, math_1.roundToPrecision)(sum / this.INDEXATION_RATE_REFERENCES.length, 3);
88
88
  },
89
89
  INDEXATION_RATE_REFERENCES: [
90
90
  [2007, 0.020],
@@ -15,12 +15,12 @@ const date_1 = require("../utils/date");
15
15
  const math_1 = require("../utils/math");
16
16
  exports.OAS = {
17
17
  getRequestDateFactor(birthDate, requestDate) {
18
- const minRequestDate = date_1.addYearsToDate(birthDate, this.MIN_AGE);
19
- const maxRequestDate = date_1.addYearsToDate(birthDate, this.MAX_AGE);
20
- const monthsToToday = date_1.getMonthsDiff(birthDate, date_1.now());
21
- const monthsToMinRequestDate = date_1.getMonthsDiff(birthDate, minRequestDate);
22
- const monthsToMaxRequestDate = date_1.getMonthsDiff(birthDate, maxRequestDate);
23
- const monthsToRequestDate = date_1.getMonthsDiff(birthDate, requestDate);
18
+ const minRequestDate = (0, date_1.addYearsToDate)(birthDate, this.MIN_AGE);
19
+ const maxRequestDate = (0, date_1.addYearsToDate)(birthDate, this.MAX_AGE);
20
+ const monthsToToday = (0, date_1.getMonthsDiff)(birthDate, (0, date_1.now)());
21
+ const monthsToMinRequestDate = (0, date_1.getMonthsDiff)(birthDate, minRequestDate);
22
+ const monthsToMaxRequestDate = (0, date_1.getMonthsDiff)(birthDate, maxRequestDate);
23
+ const monthsToRequestDate = (0, date_1.getMonthsDiff)(birthDate, requestDate);
24
24
  const monthsToLastBirthDay = monthsToToday - (monthsToToday % 12);
25
25
  // Request date is before minimum request date
26
26
  if (monthsToRequestDate < monthsToMinRequestDate) {
@@ -30,7 +30,7 @@ exports.OAS = {
30
30
  if (monthsToMaxRequestDate < monthsToToday || monthsToRequestDate < monthsToLastBirthDay) {
31
31
  return 1;
32
32
  }
33
- let monthsDelta = math_1.clamp(monthsToRequestDate, monthsToMinRequestDate, monthsToMaxRequestDate);
33
+ let monthsDelta = (0, math_1.clamp)(monthsToRequestDate, monthsToMinRequestDate, monthsToMaxRequestDate);
34
34
  monthsDelta -= Math.max(monthsToLastBirthDay, monthsToMinRequestDate);
35
35
  return 1 + (monthsDelta * this.MONTHLY_DELAY_BONUS);
36
36
  },
@@ -53,14 +53,14 @@ exports.QPP = {
53
53
  },
54
54
  getRequestDateFactor(birthDate, requestDate, customReferenceDate) {
55
55
  const { BONUS, PENALTY } = this.MONTHLY_DELAY;
56
- const minRequestDate = date_1.addYearsToDate(birthDate, this.MIN_REQUEST_AGE);
57
- const maxRequestDate = date_1.addYearsToDate(birthDate, this.MAX_REQUEST_AGE);
58
- const referenceDate = customReferenceDate || date_1.addYearsToDate(birthDate, this.DEFAULT_REFERENCE_AGE);
59
- const monthsToToday = date_1.getMonthsDiff(birthDate, date_1.now());
60
- const monthsToMinRequestDate = date_1.getMonthsDiff(birthDate, minRequestDate);
61
- const monthsToMaxRequestDate = date_1.getMonthsDiff(birthDate, maxRequestDate);
62
- const monthsToReferenceDate = date_1.getMonthsDiff(birthDate, referenceDate);
63
- const monthsToRequestDate = date_1.getMonthsDiff(birthDate, requestDate);
56
+ const minRequestDate = (0, date_1.addYearsToDate)(birthDate, this.MIN_REQUEST_AGE);
57
+ const maxRequestDate = (0, date_1.addYearsToDate)(birthDate, this.MAX_REQUEST_AGE);
58
+ const referenceDate = customReferenceDate || (0, date_1.addYearsToDate)(birthDate, this.DEFAULT_REFERENCE_AGE);
59
+ const monthsToToday = (0, date_1.getMonthsDiff)(birthDate, (0, date_1.now)());
60
+ const monthsToMinRequestDate = (0, date_1.getMonthsDiff)(birthDate, minRequestDate);
61
+ const monthsToMaxRequestDate = (0, date_1.getMonthsDiff)(birthDate, maxRequestDate);
62
+ const monthsToReferenceDate = (0, date_1.getMonthsDiff)(birthDate, referenceDate);
63
+ const monthsToRequestDate = (0, date_1.getMonthsDiff)(birthDate, requestDate);
64
64
  const monthsToLastBirthDay = monthsToToday - (monthsToToday % 12);
65
65
  // Request date is before minimum request date
66
66
  if (monthsToRequestDate < monthsToMinRequestDate) {
@@ -74,13 +74,13 @@ exports.QPP = {
74
74
  if (monthsToToday > monthsToReferenceDate && monthsToRequestDate < monthsToLastBirthDay) {
75
75
  return 1;
76
76
  }
77
- let monthsDelta = math_1.clamp(monthsToRequestDate, monthsToMinRequestDate, monthsToMaxRequestDate);
77
+ let monthsDelta = (0, math_1.clamp)(monthsToRequestDate, monthsToMinRequestDate, monthsToMaxRequestDate);
78
78
  monthsDelta -= Math.max(monthsToLastBirthDay, monthsToReferenceDate);
79
79
  return 1 + monthsDelta * (monthsDelta >= 0 ? BONUS : PENALTY);
80
80
  },
81
81
  getAverageIndexationRate() {
82
82
  const sum = this.INDEXATION_RATE_REFERENCES.reduce((previous, current) => previous + current[1], 0);
83
- return math_1.roundToPrecision(sum / this.INDEXATION_RATE_REFERENCES.length, 2);
83
+ return (0, math_1.roundToPrecision)(sum / this.INDEXATION_RATE_REFERENCES.length, 2);
84
84
  },
85
85
  INDEXATION_RATE_REFERENCES: [
86
86
  [2007, 0.021],
@@ -6,7 +6,7 @@ Sources
6
6
  Abattement QC: http://www.cra-arc.gc.ca/tx/ndvdls/tpcs/ncm-tx/rtrn/cmpltng/ddctns/lns409-485/440-fra.html
7
7
 
8
8
  Revised
9
- 2021-12-22
9
+ 2022-01-11
10
10
  */
11
11
  // tslint:enable:max-line-length
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -106,7 +106,7 @@ exports.TAX_BRACKETS = {
106
106
  TO: 227091,
107
107
  RATE: 0.168,
108
108
  }, {
109
- FROM: 222420,
109
+ FROM: 227091,
110
110
  TO: 999999999,
111
111
  RATE: 0.205,
112
112
  }],
@@ -122,14 +122,14 @@ exports.TAX_BRACKETS = {
122
122
  BASE_TAX_CREDIT: 10145,
123
123
  RATES: [{
124
124
  FROM: 0,
125
- TO: 33723,
125
+ TO: 34431,
126
126
  RATE: 0.108,
127
127
  }, {
128
- FROM: 33723,
129
- TO: 72885,
128
+ FROM: 34431,
129
+ TO: 74416,
130
130
  RATE: 0.1275,
131
131
  }, {
132
- FROM: 72885,
132
+ FROM: 74416,
133
133
  TO: 999999999,
134
134
  RATE: 0.174,
135
135
  }],
@@ -540,27 +540,27 @@ exports.getProvincialBaseCredit = getProvincialBaseCredit;
540
540
  function getTotalMarginalRate(provincialCode, grossIncome, inflationRate = 0, yearsToInflate = 0) {
541
541
  const provRate = getProvincialMarginalRate(provincialCode, grossIncome, inflationRate, yearsToInflate);
542
542
  const fedRate = getFederalMarginalRate(provincialCode, grossIncome, inflationRate, yearsToInflate);
543
- return utils_1.roundToPrecision(provRate + fedRate, 4);
543
+ return (0, utils_1.roundToPrecision)(provRate + fedRate, 4);
544
544
  }
545
545
  exports.getTotalMarginalRate = getTotalMarginalRate;
546
546
  function getMaxProvincialMarginalRate(provincialCode) {
547
547
  // tslint:disable-next-line:no-non-null-assertion
548
- const marginalRate = collections_1.maxBy(getTaxRates(provincialCode), (bracket) => bracket.TO).RATE;
548
+ const marginalRate = (0, collections_1.maxBy)(getTaxRates(provincialCode), (bracket) => bracket.TO).RATE;
549
549
  // tslint:disable-next-line:no-non-null-assertion
550
- const surtaxRate = collections_1.maxBy(getSurtaxRates(provincialCode), bracket => bracket.TO).RATE;
550
+ const surtaxRate = (0, collections_1.maxBy)(getSurtaxRates(provincialCode), bracket => bracket.TO).RATE;
551
551
  return marginalRate + (marginalRate * surtaxRate);
552
552
  }
553
553
  exports.getMaxProvincialMarginalRate = getMaxProvincialMarginalRate;
554
554
  function getMaxFederalMarginalRate(provincialCode) {
555
555
  // tslint:disable-next-line:no-non-null-assertion
556
- const maxRate = collections_1.maxBy(getTaxRates(code_types_1.FEDERAL_CODE), bracket => bracket.TO).RATE;
556
+ const maxRate = (0, collections_1.maxBy)(getTaxRates(code_types_1.FEDERAL_CODE), bracket => bracket.TO).RATE;
557
557
  return maxRate * (1 - getAbatement(provincialCode));
558
558
  }
559
559
  exports.getMaxFederalMarginalRate = getMaxFederalMarginalRate;
560
560
  function getTotalMaxMarginalRate(provincialCode) {
561
561
  const provRate = getMaxProvincialMarginalRate(provincialCode);
562
562
  const fedRate = getMaxFederalMarginalRate(provincialCode);
563
- return utils_1.roundToPrecision(provRate + fedRate, 4);
563
+ return (0, utils_1.roundToPrecision)(provRate + fedRate, 4);
564
564
  }
565
565
  exports.getTotalMaxMarginalRate = getTotalMaxMarginalRate;
566
566
  function getTotalTaxAmount(provincialCode, grossIncome, inflationRate = 0, yearsToInflate = 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equisoft/tax-ca",
3
- "version": "2022.0.0",
3
+ "version": "2022.0.1",
4
4
  "description": "Canadian tax data and calculation functions.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",