Skip to content

A local-first personal finance app

fix negative amount parsing (#4489)

Matt Fiddaman6db52ca7a81c
diff --git a/packages/loot-core/src/shared/util.ts b/packages/loot-core/src/shared/util.ts
index 9ce69619c2..7e78485bc5 100644
--- a/packages/loot-core/src/shared/util.ts
+++ b/packages/loot-core/src/shared/util.ts
@@ -399,9 +399,9 @@ export function currencyToAmount(currencyAmount: string): Amount | null {
match.index + 4 === currencyAmount.length)
) {
fraction = null;
- integer = currencyAmount.replace(/\D/g, '');
+ integer = currencyAmount.replace(/[^\d-]/g, '');
} else {
- integer = currencyAmount.slice(0, match.index).replace(/\D/g, '');
+ integer = currencyAmount.slice(0, match.index).replace(/[^\d-]/g, '');
fraction = currencyAmount.slice(match.index + 1);
}
diff --git a/upcoming-release-notes/4489.md b/upcoming-release-notes/4489.md
new file mode 100644
index 0000000000..d3651694e3
--- /dev/null
+++ b/upcoming-release-notes/4489.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [matt-fidd]
+---
+
+Fix negative amout parsing