Align amount conversion utilities between api and loot-core (#5747)

* Align amount conversion utilities between api and loot-core

Updates api amount conversion utilities to align with loot-core, improving consistency and maintainability across the project.

Uses decimal places as parameters in conversion functions.

* Moves amount conversion utils to core

Moves amount conversion utilities to the core library.

This change consolidates these utilities for better code reuse
and maintainability across different parts of the application.
It removes the duplicate definition from the API package and
imports it from the core library where it is shared.
This commit is contained in:
Stephen Brown II
2025-10-05 09:23:34 -04:00
committed by GitHub
parent e54dc0c1ca
commit 805e2b1807
4 changed files with 8 additions and 9 deletions

View File

@@ -1,7 +0,0 @@
export function amountToInteger(n) {
return Math.round(n * 100);
}
export function integerToAmount(n) {
return parseFloat((n / 100).toFixed(2));
}

1
packages/api/utils.ts Normal file
View File

@@ -0,0 +1 @@
export { amountToInteger, integerToAmount } from 'loot-core/shared/util';