[Bug]: Reconcile incorrectly parses amounts in swiss francs #2474

Closed
opened 2026-02-28 20:14:49 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @jullanggit on GitHub (Sep 14, 2025).

Verified issue does not already exist?

  • I have searched and found no existing issue

What happened?

When reconciling and entering an amount like '2’805.53 Fr.' (a possible default value) I get this:

Your cleared balance 2’805.53 Fr. needs +277’747.47 Fr. to match your bank's balance of 280’553.00 Fr.

I think the parser incorrectly uses the '.' after 'Fr' as the decimal point, as this does not happen if I remove the '.'.

I have tried, but failed, to track down this issue. The input seems to follow this path:

desktop-client/src/components/accounts/Reconcile.tsx:ReconcileMenu:onsubmit 
   -> evalArithmetic -> .. -> parsePrimary -> currencyToAmount
   -> amountToInteger
   -> onReconcile
   ...

As far as I could tell everything from evalArithmetic onwards looks the most suspicious, but should work out; currencyToAmount does just use the last '.' as the decimal point, which could be the issue, but everything from the 'F' onwards should have already been filtered out by the regex loop in parsePrimary.
I have confirmed this by adding a test to arithmetic.test.ts, which does seem to correctly parse the given string.

I don't think amountToInteger or onReconcile are to blame here, they both seem pretty simple and don't have any code related to decimal points.

At the end, I am not really sure what causes this, so I am opening this issue, but if someone has an idea what it could be, I would be happy to implement the fix myself!

How can we reproduce the issue?

Set currency to Swiss franc and symbol position to after amount, then reconcile.

Where are you hosting Actual?

Locally via Yarn

What browsers are you seeing the problem on?

Firefox

Operating System

Linux

Originally created by @jullanggit on GitHub (Sep 14, 2025). ### Verified issue does not already exist? - [x] I have searched and found no existing issue ### What happened? When reconciling and entering an amount like '2’805.53 Fr.' (a possible default value) I get this: ``` Your cleared balance 2’805.53 Fr. needs +277’747.47 Fr. to match your bank's balance of 280’553.00 Fr. ``` I think the parser incorrectly uses the '.' after 'Fr' as the decimal point, as this does not happen if I remove the '.'. I have tried, but failed, to track down this issue. The input seems to follow this path: ``` desktop-client/src/components/accounts/Reconcile.tsx:ReconcileMenu:onsubmit -> evalArithmetic -> .. -> parsePrimary -> currencyToAmount -> amountToInteger -> onReconcile ... ``` As far as I could tell everything from `evalArithmetic` onwards looks the most suspicious, but should work out; `currencyToAmount` does just use the last '.' as the decimal point, which could be the issue, but everything from the 'F' onwards should have already been filtered out by the regex loop in `parsePrimary`. I have confirmed this by adding a test to `arithmetic.test.ts`, which does seem to correctly parse the given string. I don't think `amountToInteger` or `onReconcile` are to blame here, they both seem pretty simple and don't have any code related to decimal points. At the end, I am not really sure what causes this, so I am opening this issue, but if someone has an idea what it could be, I would be happy to implement the fix myself! ### How can we reproduce the issue? Set currency to Swiss franc and symbol position to `after amount`, then reconcile. ### Where are you hosting Actual? Locally via Yarn ### What browsers are you seeing the problem on? Firefox ### Operating System Linux
GiteaMirror added the user interfacebug labels 2026-02-28 20:14:49 -06:00
Author
Owner

@youngcw commented on GitHub (Sep 15, 2025):

I don't think it has anything to do with the currency support. The parsing wont accept numbers of the format 1'000 at all. With the currency set to CHF and symbol after, it parses fine if you exclude the ' from the number

@youngcw commented on GitHub (Sep 15, 2025): I don't think it has anything to do with the currency support. The parsing wont accept numbers of the format 1'000 at all. With the currency set to CHF and symbol after, it parses fine if you exclude the `'` from the number
Author
Owner

@jullanggit commented on GitHub (Sep 15, 2025):

Interesting, then I would suggest changing the code for the default value of the field to not include numbers of this format, as the string above was the default for me.

@jullanggit commented on GitHub (Sep 15, 2025): Interesting, then I would suggest changing the code for the default value of the field to not include numbers of this format, as the string above was the default for me.
Author
Owner

@jullanggit commented on GitHub (Sep 15, 2025):

Okay, it seems like v25.9.0 fixed the issue, even though I had tried to look for changes in between to make sure I wasn't reporting an already resolved issue, but it seems like I missed the fixing change.
Thank you for your time and the continued great work on actual!

@jullanggit commented on GitHub (Sep 15, 2025): Okay, it seems like v25.9.0 fixed the issue, even though I had tried to look for changes in between to make sure I wasn't reporting an already resolved issue, but it seems like I missed the fixing change. Thank you for your time and the continued great work on actual!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#2474