Skip to content
GitHub
Browse the docs

Money

Money helpers

Money

Integer minor-unit Money helpers from @booki-aui/core.

The person sees

$125.00
($4,250.00)
Install
pnpm add @booki-aui/core

Usage example

JavaScript
import {
  addMoney, formatMoney, minorFromDecimal, money,
} from "@booki-aui/core/money"

const net = money(minorFromDecimal("125.00", "USD"), "USD")
const tax = money(1000, "USD")
const total = addMoney(net, tax)

console.log(total) // { minor: 13500, currency: "USD" }
console.log(formatMoney(total, { locale: "en-US" })) // $135.00

Keep 13500 cents in storage and format $135.00 for display. addMoney requires matching currencies.