Open source personal finance application
fix: update decimal precision and input formatting in calculate utility
Ilya Komichev3a1757034ad4
diff --git a/app/components/trnForm/utils/calculate.ts b/app/components/trnForm/utils/calculate.tsindex 2cd120dd..5605c33f 100644--- a/app/components/trnForm/utils/calculate.ts+++ b/app/components/trnForm/utils/calculate.ts@@ -1,7 +1,7 @@import { formatByCurrency } from '~/components/amount/utils'const config = {- decimalPlaces: 2,+ decimalPlaces: 8,maxIntegerLength: 999,separator: ' ',} as const@@ -114,12 +114,13 @@ export function formatInput(value: CalculatorInput): string {if (isOperator(part))return ` ${part} `+ const isDecimal = part.at(-1) === '.'const [integerPart, decimalPart] = sanitizeInput(part).split('.')const formattedInteger = formatByCurrency(integerPart || '', config.separator)return decimalPart? `${formattedInteger}.${decimalPart}`- : formattedInteger+ : `${formattedInteger}${isDecimal ? '.' : ''}`}).join('')}