Calculate Dutch car tax (motorrijtuigenbelasting) in JavaScript
Note: in development
This module is in development. The implemented rules are tested and verified, but quite some rules are not implemented yet. Contributions are very welcome!
Visit autokosten.tools to calculate Dutch
car tax.
In the examples below, we use yarn dlx
to run
the CLI. You can also use npx
,
it should work exactly the same.
Example with manual input:
yarn dlx @motorrijtuigenbelasting/cli \
--vehicle-type Personenauto \
--weight 1051 \
--propulsion-type Benzine \
--co2-emission 86 \
--province Utrecht
Example with vehicle ID (kenteken) as input:
export RDW_APP_TOKEN=foo
yarn dlx @motorrijtuigenbelasting/cli \
--vehicle-id S-212-PK
--province Utrecht
Example output:
Note: App token can be obtained after registering at the RDW open data portal.
yarn|npm add @motorrijtuigenbelasting/core @motorrijtuigenbelasting/mrb2023
Note: When you want to use a different revision of the car tax law, use the corresponding package. See elsewhere in this README to see a list of supported revisions.
import {
PropulsionType,
Province,
run,
VehicleType,
} from "@motorrijtuigenbelasting/core";
import mrb2023 from "@motorrijtuigenbelasting/mrb2023";
const params = {
vehicleType: VehicleType.Personenauto,
weight: 1051,
propulsions: [{ type: PropulsionType.Benzine, co2Emission: 86 }],
province: Province.Utrecht,
};
const results = run(mrb2023, params);
console.log({ results });
To obtain params from the RDW from a vehicle ID (kenteken), use the
@motorrijtuigenbelasting/rdw
package:
import { fetchRdwData, getParamsFromRdw } from "@motorrijtuigenbelasting/rdw";
const vehicleId = "S-212-PK";
const rdwAppToken = "foo";
const rdwData = await fetchRdwData(vehicleId, rdwAppToken);
const params = rdwDataToParams(rdwData);
Contributions are very welcome!
- CLI
- MRB2023
- Personenauto
- Propulsion types
- Provinces
- Low emission
- No emission
- Bestelauto particulier
- Propulsion types
- Particulate matter surtax
- No emission
- Bestelauto gehandicapte
- Bestelauto ondernemer
- Propulsion types
- Particulate matter surtax
- No emission
- Motor
- Aanhangwagen/oplegger
- Kampeerauto
- Propulsion types
- Rented for business purposes
- Particulate matter surtax
- No emission
- Caravan, vouwwagen of woonwagen
- Autobus
- Rijdende winkel
- Handelaarskenteken
- Vrachtauto
- Personenauto
- Convert RDW data
- Vehicle type (incomplete)
- Weight
- Propulsion types
- Particulate matter surtax (incomplete)
- Betalennaargebruik package
- Emit warning when there is a known discrepancy between the model and the official calculator
See TODO.md for known problems which need fixing and general todos.
To run the @motorrijtuigenbelasting/cli
package from source, run:
cd packages/cli
yarn start
A devcontainer configuration is included in this repo to get started quickly.
Β©οΈ Copyright 2023 Joram van den Boezem
β»οΈ Licensed under the MIT license