Skip to content

Commit

Permalink
allow specifically 5 decimal places in parser
Browse files Browse the repository at this point in the history
  • Loading branch information
youngcw committed Apr 11, 2024
1 parent b879518 commit 9f52f27
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/loot-core/src/shared/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,9 @@ export function looselyParseAmount(amount: string) {
amount = amount.replace('(', '-').replace(')', '');
}

const m = amount.match(/[.,][^.,]{1,2}$/);
//look for a decimal marker, then look for either 5 or 1-2 decimal places.
// This avoids matching against 3 places which may not actually be decimal
const m = amount.match(/[.,]([^.,]{5}|[^.,]{1,2})$/);
if (!m || m.index === undefined || m.index === 0) {
return safeNumber(parseFloat(extractNumbers(amount)));
}
Expand Down

0 comments on commit 9f52f27

Please sign in to comment.