Skip to content

fix(dashboard): render money in the property's currency, not hardcoded USD - #301

Open
modernitconsultants wants to merge 1 commit into
TelivityAI:mainfrom
modernitconsultants:fix/currency-display
Open

fix(dashboard): render money in the property's currency, not hardcoded USD#301
modernitconsultants wants to merge 1 commit into
TelivityAI:mainfrom
modernitconsultants:fix/currency-display

Conversation

@modernitconsultants

Copy link
Copy Markdown

Running a property with currencyCode: 'JPY', every money value in the dashboard renders as US dollars — a ¥511,275 reservation shows as $511275.00.

Two defects, the second worse than the first

Display (18 sites). `$${Number(amount).toFixed(2)}` — a hardcoded symbol and hardcoded two decimal places, ignoring the currencyCode that is already on every record. For yen the decimals are wrong too: JPY has no minor unit, so the correct render is ¥511,275.

Writes (7 sites). currencyCode: 'USD' is hardcoded when creating rate plans, reservations, house accounts and ledger entries. On a non-USD property that writes incorrect data silently — a rate plan created through the UI on a yen property is stored as USD.

The root of both: PropertySummary doesn't carry currencyCode, so the dashboard has no way to know the property's currency even though the API returns it.

The change

  • lib/money.tsformatMoney / formatMoneyPlain via Intl.NumberFormat, so symbol, separators and fraction digits all derive from the ISO 4217 code. Unknown codes degrade to 1234.00 XYZ rather than a wrong symbol.
  • currencyCode added to PropertySummary and exposed from PropertyContext. Portfolio mode falls back to the default deliberately — properties spanning currencies have no single answer, and asserting one property's code over others would be wrong.
  • All 18 render sites and all 7 create sites routed through it.
  • NightAudit's revenue helper is module-level so it takes the currency as a parameter rather than reaching for a hook.

Notes

Removed a local formatMoney shadow in Channels.tsx that duplicated the new shared helper.

You ship German, Portuguese, Spanish, French, Croatian, Italian and Serbian dashboard locales — this is the money half of that same internationalisation, and it currently blocks any non-USD operator.

Found running HAIP self-hosted for a property trading in yen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant