🧾 Canadian sales tax calculator
This package exports a single class. It's rather small and only does one thing: calculate CAD taxes. For those who just care about the total, you can call sum
, as shown below, or you can get a tax trace using get
.
Note that the constructor takes three arguments:
- The two-letter province code;
- The taxable number value;
- The number of decimal points to include in output.
const SalesTax = ; const tax = 'ON' // reference rates.json if unsure 2141 // ensure that this is a number 2 // leave blank for raw result ; tax; // returns an array of all chargeable taxes tax; // returns the total payable tax
Method | Description |
---|---|
get |
Returns an array of applicable taxes |
get |
Returns the total payable tax (reduces get results) |
Rate table
Province | Tax | GST | HST | QST | PST | Total |
---|---|---|---|---|---|---|
Alberta | GST | 5% | -- | -- | -- | 5% |
British Columbia | GST + PST | 5% | -- | -- | 7% | 12% |
Manitoba | GST + PST | 5% | -- | -- | 7% | 12% |
New Brunswick | HST | -- | 15% | -- | -- | 15% |
Newfoundland and Labrador | HST | -- | 15% | -- | -- | 15% |
Northwest Territories | GST | 5% | -- | -- | -- | 5% |
Nova Scotia | HST | -- | 15% | -- | -- | 15% |
Nunavut | GST | 5% | -- | -- | -- | 5% |
Ontario | HST | -- | 13% | -- | -- | 13% |
Prince Edward Island | HST | -- | 15% | -- | -- | 15% |
Quebec | GST + QST | 5% | -- | 9.975% | -- | 14.98% |
Saskatchewan | GST + PST | 5% | -- | -- | 6% | 11% |
Yukon | GST | 5% | -- | -- | -- | 5% |