[PR #4383] [MERGED] Fix currencyToAmount incorrectly converting input #12408

Closed
opened 2026-04-10 21:28:58 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/4383
Author: @AntoineTA
Created: 2/15/2025
Status: Merged
Merged: 2/19/2025
Merged by: @joel-jeremy

Base: masterHead: fix-4277


📝 Commits (10+)

  • 3c5c4bd fix: ensure currencyToAmount works regardless of the configured number format
  • 1a50d92 chore: linting
  • 31e8570 docs: add release note
  • b25e855 Merge branch 'master' into fix-4277
  • 33ca054 Merge branch 'master' into fix-4277
  • 96396b5 test: ensure correct amount is entered for debit when adding split transactions
  • c8eca6e Merge branch 'master' into fix-4277
  • ddd6309 chore: rename variable thousandsSep to thousandsSeparator
  • 5e981a1 chore: rename variable decimalSep to decimalSeparator
  • 1c65b4b Merge branch 'master' into fix-4277

📊 Changes

3 files changed (+39 additions, -33 deletions)

View changed files

📝 packages/desktop-client/e2e/page-models/account-page.ts (+2 -1)
📝 packages/loot-core/src/shared/util.ts (+31 -32)
upcoming-release-notes/4383.md (+6 -0)

📄 Description

Fixes #4277

The issue described there arises because the currencyToAmount() utility function expects a string representing an amount in the current number format (dot-comma in this case). However, at some point during the update, the function is passed a string where the decimal separator is represented with a dot. This causes the function to ignore the decimal separator when converting the string to the exact amount.

The fact that currencyToAmount() expects a string in the current number format also causes other unintended behaviour.

  • In some cases, if the user does not use the decimal separator defined by their number format when entering an amount, the separator will be ignored. For example, when using comma-dot format, the input 1,83 will be saved as 183.00.
  • Similarly, if the user does not use the expected separator when searching for an amount, the search will yield no result.

This PR solves these issues by making sure currencyToAmount() is able to handle any currency string, not just those in the format configured by the user.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/4383 **Author:** [@AntoineTA](https://github.com/AntoineTA) **Created:** 2/15/2025 **Status:** ✅ Merged **Merged:** 2/19/2025 **Merged by:** [@joel-jeremy](https://github.com/joel-jeremy) **Base:** `master` ← **Head:** `fix-4277` --- ### 📝 Commits (10+) - [`3c5c4bd`](https://github.com/actualbudget/actual/commit/3c5c4bdca5e771b68f01bfb715b41d65ec17c04e) fix: ensure currencyToAmount works regardless of the configured number format - [`1a50d92`](https://github.com/actualbudget/actual/commit/1a50d925a33ff08d706f0002b91e468dead4ee1c) chore: linting - [`31e8570`](https://github.com/actualbudget/actual/commit/31e85709a97db619c84c90e7dc88a2101191e326) docs: add release note - [`b25e855`](https://github.com/actualbudget/actual/commit/b25e85555c35bea27e59e2e1611e9fb30b05b691) Merge branch 'master' into fix-4277 - [`33ca054`](https://github.com/actualbudget/actual/commit/33ca054285ea342906de1b96f1f1c169af8c03c1) Merge branch 'master' into fix-4277 - [`96396b5`](https://github.com/actualbudget/actual/commit/96396b5adbc4b49d467bdd0610b70e0d7ddd9c1e) test: ensure correct amount is entered for debit when adding split transactions - [`c8eca6e`](https://github.com/actualbudget/actual/commit/c8eca6eed5fc6f50e6373e62327680741101e7e5) Merge branch 'master' into fix-4277 - [`ddd6309`](https://github.com/actualbudget/actual/commit/ddd6309595eaf1ba959326a9e10d78de62c9532f) chore: rename variable thousandsSep to thousandsSeparator - [`5e981a1`](https://github.com/actualbudget/actual/commit/5e981a1db9f14e53e19ffad7839242c2f56f5db2) chore: rename variable decimalSep to decimalSeparator - [`1c65b4b`](https://github.com/actualbudget/actual/commit/1c65b4bd6a23382dca75c42b1ed01ee5df3ab812) Merge branch 'master' into fix-4277 ### 📊 Changes **3 files changed** (+39 additions, -33 deletions) <details> <summary>View changed files</summary> 📝 `packages/desktop-client/e2e/page-models/account-page.ts` (+2 -1) 📝 `packages/loot-core/src/shared/util.ts` (+31 -32) ➕ `upcoming-release-notes/4383.md` (+6 -0) </details> ### 📄 Description Fixes #4277 The issue described there arises because the `currencyToAmount()` utility function expects a string representing an amount in the current number format (dot-comma in this case). However, at some point during the update, the function is passed a string where the decimal separator is represented with a dot. This causes the function to ignore the decimal separator when converting the string to the exact amount. The fact that `currencyToAmount()` expects a string in the current number format also causes other unintended behaviour. - In some cases, if the user does not use the decimal separator defined by their number format when entering an amount, the separator will be ignored. For example, when using comma-dot format, the input `1,83` will be saved as `183.00`. - Similarly, if the user does not use the expected separator when searching for an amount, the search will yield no result. This PR solves these issues by making sure `currencyToAmount()` is able to handle any currency string, not just those in the format configured by the user. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-10 21:28:58 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#12408