Skip to content

Reverts HUF subunits back to ISO 4217 #1098

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

matid
Copy link

@matid matid commented May 5, 2024

Subunits of Hungarian forint are no longer in circulation and were eliminated in #679.
However, ISO continues to treat HUF as a two decimal place currency.
This can be confirmed against the standard here: https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml

To align Money with the ISO 4217 standard, this change restores original behavior of considering HUF a 2 decimal point currency.

Subunits of Hungarian forint are no longer in circulation and were eliminated in RubyMoney#679.
However, ISO continues to treat HUF as a two decimal place currency.
This can be confirmed against the standard here: https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml

To align Money with the ISO 4217 standard, this change restores original behavior of considering HUF a 2 decimal point currency.
Copy link
Contributor

@sunny sunny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m wary of introducing this change, since codebases using this have been relying on having no subunit.

Could we add a changelog entry describing the breaking change with some code to add to an app that would keep the previous behavior? 🙏🏻

@tagliala
Copy link
Contributor

For new maintainers: please note that this PR and #1092 take opposite approaches regarding subunit definitions

This PR aligns HUF with ISO 4217, using 2 decimals even though subunits are obsolete. In contrast, #1092 sets ALL to 0 decimals to match JavaScript’s Intl.NumberFormat, even though ISO 4217 specifies 2 decimals for ALL.

I recommend that the library choose a clear, consistent standard. If developers need to match application-specific behavior (like JavaScript’s formatting), they can override the defaults as needed. Consistency will help reduce confusion and make maintenance easier for everyone.

I would personally merge this PR, document the breaking change, and mark as "won't fix" the other one

I've created a table to compare ISO 4217 and JS's https://gist.github.com/tagliala/9769f26ab300d5a156e1e4893c5e4d51 (note: the script is AI generated)

It appears that Chrome's JS engine is not respecting the ISO standard, Firefox does

@matid
Copy link
Author

matid commented Jul 12, 2025

Shopify/money aligns standard subunits to ISO 4217 but has support for converters that align subunits to other formats (like Stripe’s) if someone's looking for an alternative solution to this.

@sunny
Copy link
Contributor

sunny commented Jul 13, 2025

@matid Shouldn’t we also need to change the smallest_denomination and subunit entries here?

As for the changelog, I was thinking of something like this to ease the upgrade:

- **Breaking change**: Fix HUF back to 2 decimals to align with ISO 4217
  (change subunit_to_unit from 1 to 100).

  To keep the previous behavior, call:

  ```rb
  Money::Currency.register(
    **Money::Currency.table[:huf],
    subunit_to_unit: 1,
    subunit: "",
    smallest_denomination: 5,
  )

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.

3 participants