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
Revert CHF format changes introduced in v6.14 #967
Revert CHF format changes introduced in v6.14 #967
Conversation
@kennyadsl sorry for the breaking change. I wonder if setting for format to just Basically that change was not supposed to be breaking and should have retained the same formatting, but expressed using a new attribute. However looks like CHF has slipped. |
@antstorm no need to say sorry and thanks for the answer. 🙏
The issue with CHF is the opposite, the new version is actually removing the space between CHF and the amount. Old version:
New version:
If you look at the changes to the currencies introduced in #943, you'll notice that CHF is the only currency that has the format specified and I think this was done by mistake and/or it has been done to have a currency to test in the specs, see here. That's why I created the new It's a new domain for me and I know I may be missing something important here so, if needed, feel free to point it out and I'll adjust the PR accordingly. Thanks again! |
Not sure I'm following here, this is what I'm getting: >> Money.locale_backend = nil
=> nil
>> Money::VERSION
=> "6.14.0"
>> Money.new(1234, 'CHF').format
=> "CHF 12.34" This is what your "old version" example is showing and seems to be the correct behaviour — |
Oh, ok the older version does not have a space: >> Money.locale_backend = nil
=> nil
>> Money::VERSION
=> "6.13.8"
>> Money.new(1234, 'CHF').format
=> "CHF12.34" But you can get the same behaviour with the new version: >> Money::VERSION
=> "6.14.0"
>> Money.new(1234, 'CHF').format
=> "CHF 12.34"
>> Money.new(1234, 'CHF').format(format: '%u%n')
=> "CHF12.34" So basically you need to update the |
Thanks for the feedback. I think you are right, it's the other way around and we have some configuration that for some reason swaps the space between versions, I still can't get which one though. Anyway, I think that removing the |
@kennyadsl yes, but the intention is to get rid of This is why the change was applied in the first place. Happy to accept a PR fixing the incorrect format for CHF |
cf1ae72
to
ae25e46
Compare
symbol_with_spec is not actually implmented in the codebase. It looks like a leftover from initial commits of RubyMoney#943.
Looks like RubyMoney#943 introduced the format config only on currencies that have `symbol_first` set to `false`. CHF is not one of them and needs a different format. This configuration is currently changing how CHF is displayed. From: Money.new(1234, 'CHF').format # => "CHF12.34" To: Money.new(1234, 'CHF').format # => "CHF 12.34" This commit restores the old formatting.
ae25e46
to
296a17e
Compare
@antstorm Thanks for the feedback, I made the change in this PR directly. I still don't get why CHF is the only currency with |
Hey @antstorm, any feedback on my latest changes? 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thank you for contributing and addressing my comments 👍
Thank you for guiding me! I think this PR can also be merged now. 🙏 |
I forgot the link in my previous message 🤦 , I meant this PR. |
@antstorm Hey there, what about releasing a new version for this? |
@kennyadsl pushed 6.14.1, sorry for the delay |
As described in #966, we noticed that the default format for the
CHF
currency changed with the last version released. This PR restores the previous format and, I think, needs to be part a patch release to ensure backward compatibility.If accepted, I can send another PR to update the CHANGELOG including this in the next patch level (or making the change in this PR directly if #968 will be merged before).