@zenuinebit/tax
v0.1.0
Published
Inclusive and exclusive tax calculation with multi-component taxes (e.g. GST). Works in minor units.
Readme
@zenuinebit/tax
Tax calculation in minor units (see @zenuinebit/money). Rates are percentages.
import { calculateTax, gstIntraState } from "@zenuinebit/tax";
calculateTax(10000, 18); // { net: 10000, tax: 1800, gross: 11800, ... }
calculateTax(11800, 18, { inclusive: true }); // { net: 10000, tax: 1800, gross: 11800, ... }
calculateTax(1010, gstIntraState(5)).components; // CGST 26 + SGST 25 = 51, always adds upTax is rounded once on the total and then split across components, so component amounts always add up to the total. Negative amounts (credit notes) are supported. Tax rules vary by country and change over time: you supply the rates.
