Skip to content

Conversation

StephenBrown2
Copy link
Contributor

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, just like the typescript equivalents.

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.
@actual-github-bot actual-github-bot bot changed the title Align amount conversion utilities between api and loot-core [WIP] Align amount conversion utilities between api and loot-core Sep 19, 2025
Copy link

netlify bot commented Sep 19, 2025

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 54468eb
🔍 Latest deploy log https://app.netlify.com/projects/actualbudget/deploys/68cdb301888c530008dec706
😎 Deploy Preview https://deploy-preview-5747.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Bundle Stats — desktop-client

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
23 10.79 MB 0%

Changeset

No files were changed

View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/index.js 7.84 MB 0%
static/js/de.js 144.74 kB 0%
static/js/en-GB.js 6.84 kB 0%
static/js/en.js 130.84 kB 0%
static/js/es.js 76.41 kB 0%
static/js/fr.js 152.2 kB 0%
static/js/it.js 145.22 kB 0%
static/js/nl.js 100.13 kB 0%
static/js/pl.js 86.36 kB 0%
static/js/pt-BR.js 142.35 kB 0%
static/js/sv.js 67.34 kB 0%
static/js/th.js 188.37 kB 0%
static/js/uk.js 188.72 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 12.94 kB 0%
static/js/workbox-window.prod.es5.js 5.64 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/BackgroundImage.js 122.29 kB 0%
static/js/ReportRouter.js 829.97 kB 0%
static/js/narrow.js 451.08 kB 0%
static/js/TransactionList.js 10.92 kB 0%
static/js/wide.js 119.45 kB 0%
static/js/useAccountPreviewTransactions.js 8.52 kB 0%
static/js/useTransactionBatchActions.js 10.31 kB 0%

Copy link
Contributor

Bundle Stats — loot-core

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
1 4.29 MB → 4.29 MB (+90 B) +0.00%
Changeset
File Δ Size
home/runner/work/actual/actual/packages/api/utils.js 📈 +90 B (+123.29%) 73 B → 163 B
View detailed bundle breakdown

Added

Asset File Size % Changed
kcab.worker.CAYzZOF-.js 0 B → 4.29 MB (+4.29 MB) -

Removed

Asset File Size % Changed
kcab.worker.Ba---c3k.js 4.29 MB → 0 B (-4.29 MB) -100%

Bigger

No assets were bigger

Smaller

No assets were smaller

Unchanged

No assets were unchanged

@StephenBrown2 StephenBrown2 changed the title [WIP] Align amount conversion utilities between api and loot-core Align amount conversion utilities between api and loot-core Sep 19, 2025
Copy link
Member

@joel-jeremy joel-jeremy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have these typed

@@ -1,7 +1,9 @@
export function amountToInteger(n) {
return Math.round(n * 100);
export function amountToInteger(amount, decimalPlaces = 2) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export function amountToInteger(amount, decimalPlaces = 2) {
export function amountToInteger(amount: Amount, decimalPlaces = 2) {


export function integerToAmount(n) {
return parseFloat((n / 100).toFixed(2));
export function integerToAmount(integerAmount, decimalPlaces = 2) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export function integerToAmount(integerAmount, decimalPlaces = 2) {
export function integerToAmount(integerAmount: IntegerAmount, decimalPlaces = 2) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants