fix(dashboard): render money in the property's currency, not hardcoded USD - #301
Open
modernitconsultants wants to merge 1 commit into
Open
fix(dashboard): render money in the property's currency, not hardcoded USD#301modernitconsultants wants to merge 1 commit into
modernitconsultants wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 thecurrencyCodethat 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:
PropertySummarydoesn't carrycurrencyCode, so the dashboard has no way to know the property's currency even though the API returns it.The change
lib/money.ts—formatMoney/formatMoneyPlainviaIntl.NumberFormat, so symbol, separators and fraction digits all derive from the ISO 4217 code. Unknown codes degrade to1234.00 XYZrather than a wrong symbol.currencyCodeadded toPropertySummaryand exposed fromPropertyContext. 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.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
formatMoneyshadow inChannels.tsxthat 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.