Dashboard: don't pad money past the currency's own decimals when moneyStrategyPrecision is higher
#5446
julian-boerema
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
We run the documented three-decimal
MoneyStrategy(precision = 3) with EUR, which has two decimals. Prices at a real third decimal need it. But order totals, payments and refunds settle to whole cents, so every settled amount in the dashboard shows a dead zero:€33.280. When noprecisionis passed,useLocalFormat().formatCurrency(packages/dashboard/src/lib/hooks/use-local-format.ts) sets bothminimumFractionDigitsandmaximumFractionDigitstomoneyStrategyPrecision, and nothing lets you change that.Proposed default: show the currency's own decimals, and show the store's full precision only when the extra digits are not zero.
€12.340→€12.34, while€12.345stays€12.345¥1,000.00→¥1,000, while¥1,000.50stays¥1,000.50Nothing changes when a caller passes
precision(the metrics widget passes0), or when the store has no decimals beyond the currency's: the default precision 2 with USD or EUR. A currency with more decimals than the store keeps (BHD has 3, the store 2) stays at the store's 2 and is never padded with a zero that isn't stored.All reactions