Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikeibberson/sales-tax-cad
Canadian sales tax calculator
https://github.com/mikeibberson/sales-tax-cad
nodejs
Last synced: 19 days ago
JSON representation
Canadian sales tax calculator
- Host: GitHub
- URL: https://github.com/mikeibberson/sales-tax-cad
- Owner: MikeIbberson
- License: mit
- Created: 2020-02-03T14:49:59.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T06:22:01.000Z (almost 2 years ago)
- Last Synced: 2024-10-12T12:15:57.342Z (about 1 month ago)
- Topics: nodejs
- Language: JavaScript
- Homepage:
- Size: 968 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
๐งพ 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 usingget
.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.
```javascript
const SalesTax = require('sales-tax-cad');
const tax = new SalesTax(
'ON', // reference rates.json if unsure
21.41, // ensure that this is a number
2, // leave blank for raw result
);tax.get(); // returns an array of all chargeable taxes
tax.sum(); // returns the total payable tax
```
Method
Description
get
Returns an array of applicable taxes
get
Returns the total payable tax (reducesget
results)
Rate table
As of February 1, 2020
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%