diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a2e70e..833d14f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.5.1] - 2026-01-24 + +### Fixed +- Fixed number formatting display across all components showing monetary values. + ## [1.5.0] - 2026-01-24 ### Added diff --git a/src/components/IncomeOutcomeComparison.tsx b/src/components/IncomeOutcomeComparison.tsx index d2c5302..ab0d5b3 100644 --- a/src/components/IncomeOutcomeComparison.tsx +++ b/src/components/IncomeOutcomeComparison.tsx @@ -1,5 +1,5 @@ import { Card, Group, Progress, Stack, Text } from '@mantine/core'; -import { formatMonetaryValue } from '../utils/formatters'; +import { formatNumberToMonetary } from '../utils/formatters'; interface IncomeOutcomeComparisonProps { income: number; @@ -27,7 +27,7 @@ export const IncomeOutcomeComparison = ({ Balance: - {isPositive ? '+' : ''}{formatMonetaryValue(balance.toFixed(2))} {currency} + {isPositive ? '+' : ''}{formatNumberToMonetary(balance)} {currency} @@ -46,7 +46,7 @@ export const IncomeOutcomeComparison = ({ Total Income - {formatMonetaryValue(income.toFixed(2))} {currency} + {formatNumberToMonetary(income)} {currency} {incomePercentage.toFixed(1)}% of total @@ -56,7 +56,7 @@ export const IncomeOutcomeComparison = ({ Total Outcome - {formatMonetaryValue(outcome.toFixed(2))} {currency} + {formatNumberToMonetary(outcome)} {currency} {outcomePercentage.toFixed(1)}% of total diff --git a/src/pages/HomePage.tsx b/src/pages/HomePage.tsx index b35c160..c9422ee 100644 --- a/src/pages/HomePage.tsx +++ b/src/pages/HomePage.tsx @@ -11,7 +11,7 @@ import { getAllTransactions } from '../stores/transactionsStore'; import { AccountIcon } from '../components/AccountIcon'; import { autoUpdateExchangeRates, fetchAndUpdateExchangeRates, getSettings, initializeSettings } from '../stores/settingsStore'; import { convertAmount, convertToARS } from '../utils/currency'; -import { formatMonetaryValue } from '../utils/formatters'; +import { formatNumberToMonetary } from '../utils/formatters'; import { formatPeriodLabel } from '../utils/dateFormatters'; import type { Account, AppSettings, Category, Currency, ExchangeRates, Transaction, TransactionType, TimeWindow } from '../types'; @@ -146,7 +146,7 @@ export const HomePage = () => { ratesToUse, loadedSettings.displayCurrency, ); - setTotalDisplay(formatMonetaryValue(total.toFixed(2))); + setTotalDisplay(formatNumberToMonetary(total)); if (loadedSettings.defaultAccountId && allAccounts.some(acc => acc.id === loadedSettings.defaultAccountId)) { const selectedAccount = allAccounts.find(acc => acc.id === loadedSettings.defaultAccountId); @@ -157,7 +157,7 @@ export const HomePage = () => { ratesToUse, loadedSettings.displayCurrency ); - setAccountBalanceDisplay(formatMonetaryValue(accountBalance.toFixed(2))); + setAccountBalanceDisplay(formatNumberToMonetary(accountBalance)); } } @@ -405,7 +405,7 @@ export const HomePage = () => { newRates, settings?.displayCurrency ?? 'ARS', ); - setTotalDisplay(formatMonetaryValue(total.toFixed(2))); + setTotalDisplay(formatNumberToMonetary(total)); if (accountFilter !== null) { const selectedAccount = accounts.find(acc => acc.id === accountFilter); @@ -416,7 +416,7 @@ export const HomePage = () => { newRates, settings?.displayCurrency ?? 'ARS' ); - setAccountBalanceDisplay(formatMonetaryValue(accountBalance.toFixed(2))); + setAccountBalanceDisplay(formatNumberToMonetary(accountBalance)); } } } catch (error) { @@ -462,7 +462,7 @@ export const HomePage = () => { settings.exchangeRates, settings.displayCurrency ); - setAccountBalanceDisplay(formatMonetaryValue(accountBalance.toFixed(2))); + setAccountBalanceDisplay(formatNumberToMonetary(accountBalance)); } } }} diff --git a/src/pages/SettingsPage.tsx b/src/pages/SettingsPage.tsx index 4a27a09..20e3703 100644 --- a/src/pages/SettingsPage.tsx +++ b/src/pages/SettingsPage.tsx @@ -16,7 +16,7 @@ import { fetchAndUpdateExchangeRates, getSettings, initializeSettings, resetData import { ensureDefaultCategories } from '../stores/categoriesStore'; import type { AppSettings, Account, AutoUpdateInterval, TimeWindow, Currency, ExchangeRates } from '../types'; import { SUPPORTED_CURRENCIES } from '../utils/currency'; -import { formatMonetaryValue, parseMonetaryValue } from '../utils/formatters'; +import { formatNumberToMonetary, parseMonetaryValue } from '../utils/formatters'; import { DatabaseImportExport } from '../components/DatabaseImportExport'; export const SettingsPage = () => { @@ -191,7 +191,7 @@ export const SettingsPage = () => { }; for (const c of SUPPORTED_CURRENCIES) { const value = exchangeRates?.[c]?.toARS; - rates[c] = c === 'ARS' ? '1' : formatMonetaryValue(String(value ?? '')); + rates[c] = c === 'ARS' ? '1' : formatNumberToMonetary(value ?? 0); } return rates; }, [exchangeRates]);