Reference / @getenginex/sdk / fromMinorUnits
fromMinorUnits()
fromMinorUnits(
amountMinor,currency):number
Converts minor units into the main unit, as a number: 1999 → 19.99. Use it to show in edit fields or charts; to display money to the user use formatMoney. The result is the number closest to the decimal value: above ~15 significant digits (e.g. 9007199254740991 with 2 decimal places) the number no longer represents the decimal places.
Parameters
amountMinor
number
Amount in minor units (a safe integer).
currency
The operator's currency (config.currency).
Returns
number
Example
ts
fromMinorUnits(1999, currency) // 19.99Throws
amountMinor is not a safe integer or decimalPlaces is invalid.