Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Awesome Lists containing this project

README

        

๐Ÿงพ Canadian sales tax calculator


Status
Coverage Status

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:



  1. The two-letter province code;

  2. The taxable number value;

  3. 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 (reduces get 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%