Add main currency code for groups#329
Conversation
|
let the group add different currencies |
|
bumping for attention, had been interested in this feature for a while and have been testing this PR along with #330 through a fork. haven't noticed any bugs so far and using it to plan for an overseas trip has saved a lot of hassle concerning conversions and rates @caramelmelmel from what I saw you can set any currency of your choice for an expense, so anyone is free to input their own country's currency, the group currency mostly works to summarize all expenses into a common currency for the sake of readability and to display balances. correct me if I'm wrong, but I think this already does what you are asking for |
|
When a group's currency is changed to one with a different number of For now, we can just keep it the way it is and add a warning about this behaviour when someone attempts an edit such as this. |
Clarify group currency field description Use default currency code instead of symbol Hide currency symbol field when using a non-custom Currency Run prettier Update currency data Update package-lock.json
My main worry was for (big) previous groups using a currency without cents before this change, and wanting to opt-in by selecting their currency code, to then find all of their displayed amounts multiplied by 100. I'm not sure how widespread of a problem that would be, or how many groups on spliit use such a currency. I thought of having some sort of one-time prompt to detect whether all group expenses are whole (i.e. never use any cents), and proposing to normalize all the expense values in such a case a currency without cents is selected, but it feels overkill and maybe not really needed (could just start a new group?). Thanks a lot for the review! |
This change is to be able to define an optional main currency selection to groups, for the conversion rate feature, based on this comment.


Originally this PR was supposed to be part of the currency conversion feature, but the PR would have been a bit large.
Feature
Currency code in a group influences how amounts are displayed and handled in transactions. The "amount" value is treated as the number of minor units in the currency. For example, "1500" is treated as "$15.00" if the currency is USD, but "ISK 1500" if the currency is ISK (as some currencies like ISK, JPY do not have any cents).
Choosing a currency also enables display of the amounts with the correct symbol according to the locale.
For example:
The supported currencies are the listed currencies in Frankfurter as of this 20th April 2025.
The "currency-list" package is used to generate the json containing all the currency data as well as all the translations.
The json data can be regenerated with npm run generate-currency-data (useful when another currency or language is added in the future)
Groups without a currency code
The currency code will be undefined for all previous groups. If it is undefined, the currency symbol is required and will be used for display.
All displays will be done with a "fictional" currency defined with 100 minor units (cents) for a major unit (like Euros), this was the previous behaviour.
If the original amounts in the group were in a currency with cents, adding a currency code with cents should not have any problems.
However, if the original amounts were in a currency without cents, adding a currency will result in the amounts being 100 times higher.
For the same reason, if a currency without cents was used, and the currency code is then set to Custom, the amounts will be 100 times lower.
I haven't found a satisfying solution other to recommend not to change between currencies with different lengths.
Let me know what you think!