Changelog
View SourceNote ex_money 5.17.0 and later is supported on Elixir 1.12 and later versions only.
Money v5.23.0
This is the changelog for Money v5.23.0 released on August 25th, 2025. For older changelogs please consult the release tag on GitHub
Enhancements
- Adds
Money.sum!/2. Thanks to @andreas-ementio for the PR. Closes #187.
Money v5.22.0
This is the changelog for Money v5.22.0 released on August 15th, 2025. For older changelogs please consult the release tag on GitHub
Enhancements
- Adds
Money.Subscription.Plan.to_string/2to return a localized string representation of a subscription plan. The implementation is conditional on ex_cldr_units being configured as a dependency inmix.exsandCldr.Unitbeing added as a provider in the CLDR backend module. Thanks to @peaceful-james for the suggestion. Closes #186.
Money v5.21.0
This is the changelog for Money v5.21.0 released on March 30th, 2025. For older changelogs please consult the release tag on GitHub
Enhancements
- Add
JSON.Encoderimplementation to support serializing money types with Elixir's JSON module. Thanks to @jfpedroza for the PR. Closes #182.
Money v5.20.0
This is the changelog for Money v5.20.0 released on March 18th, 2025. For older changelogs please consult the release tag on GitHub
Soft Deprecation
- The option
:fractional_digitsforMoney.from_integer/3has been deprecated in favour of:currency_digitsfor consistency withMoney.round/2and functions in ex_cldr_numbers.:fractional_digitswill continue to be supported for an indefinite period.
Bug Fixes
Ensure
Money.split/3always returns a remainder that is greater than or equal to 0. Thanks to @jdewar for the report and @coladarci, @Wigny for their collaboration. Closes #173.Allow a non-breaking-space to be part of a number string. Some locales (like
en-ZA) will format numbers with a nbsp when using standard separators for that locale.Fix documentation for
Money.ExchangeRatesreplacing:exchange_rate_servicewith:auto_start_exchange_rate_service. Thanks to @cw789 for the PR. Closes #174.
Enhancements
Update to CLDR 47 data including update to ISO 4217 currency information.
Support passing rounding options to
Money.split/3.
Money v5.19.2
This is the changelog for Money v5.19.2 released on February 13th, 2025. For older changelogs please consult the release tag on GitHub
Bug Fixes
Fix using Elixir 1.18's JSON module in
ex_money(specifically decoding exchange rates). Thanks to @allenwyma and @maikelthedev for the report. Closes #176.Document
currency_symbol: :noneoption forMoney.to_string/2. This option formats the money amount without a currency symbol. This may be useful for UI forms that separate the currency and the amount for input. Requires ex_cldr_numbers version 2.33.6 or later.Fix parsing money strings that contain trailing RTL markers. Requires ex_cldr_currencies version 2.16.4 or later.
Money v5.19.1
This is the changelog for Money v5.19.1 released on January 22nd, 2025. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fixes
Money.within/3whenminandmaxare the same. Thanks to @joewunderlich for the report. Closes #177.
Money v5.19.0
This is the changelog for Money v5.19.0 released on January 1st, 2025. For older changelogs please consult the release tag on GitHub
Deprecations
Money.default_backend/0is soft deprecated in favor ofMoney.default_backend!/0whose naming better expresses the side effect of an exception being raised if no default backend is configured.
Bug Fixes
- Surface an error exception if, when starting the exchange rates service, no
Money.default_backend!/0is configured.
Money v5.18.0
This is the changelog for Money v5.18.0 released on September 18th, 2024. For older changelogs please consult the release tag on GitHub
Enhancements
Money v5.17.2
This is the changelog for Money v5.17.2 released on September 18th, 2024. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix implementation of
Money.exclude_protocol_implementation/1forJason.Encoder. Thanks to @wkirschbaum for the PR. Closes #171.
Enhancements
- Add
Money.exclude_protocol_implementation/1forString.Chars. Thanks to @wkirschbaum for the PR. Closes #172.
Money v5.17.1
This is the changelog for Money v5.17.1 released on September 6th, 2024. For older changelogs please consult the release tag on GitHub
Bug Fixes
Update
poisonoptional dependency to allow~> 6.0.Update
stream_datatest dependency to~> 1.0.
Enhancements
- Improve specs and broaden dialyzer configuration.
Money v5.17.0
This is the changelog for Money v5.17.0 released on May 28th, 2024. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fixes warnings on Elixir 1.17.
Money v5.16.1
This is the changelog for Money v5.16.1 released on April 23rd, 2024. For older changelogs please consult the release tag on GitHub
Bug Fixes
Money.sum/2default exchange rates is always%{}even if the exchange rate server is not running. Thanks to @haste for the report. Closes #168.
Money v5.16.0
This is the changelog for Money v5.16.0 released on April 21st, 2024. For older changelogs please consult the release tag on GitHub
Bug Fixes
When parsing numbers, use the localized number system separators where they exist. Thanks to @pshoukry for the report. Closes #167.
Surface errors when starting the exchange rates retriever. Thanks to @danschultzer for the PR. Closes #165.
Enhancements
Update to CLDR 45.0 data.
Return structured errors for
Money.ExchangeRates.latest_rates/0,Money.ExchangeRates.historic_rates/1,Money.ExchangeRates.last_updated/0andMoney.ExchangeRates.latest_rates_available?/0when the exchange rates retrieval process is not running.
Money v5.15.4
This is the changelog for Money v5.15.4 released on March 1st, 2024. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix exchange rate conversions for digital tokens. Thanks much to @ddanschultzer for the PR. Closes 164.
Enhancements
- Format the exchange rate retrieval interval used in the init message using the default
cldrbackend configured for:ex_money.
Money v5.15.3
This is the changelog for Money v5.15.3 released on January 4th, 2024. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Add
or ~> 4.0for:phoenix_htmldependency. Thanks to @wkirschbaum for the PR. Closes #161.
Money v5.15.2
This is the changelog for Money v5.15.2 released on November 3rd, 2023. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix compilation warnings on doctests on Elixir 1.16.
Money v5.15.1
This is the changelog for Money v5.15.1 released on October 10th, 2023. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fixes the exchange rate retriever, removing the double retrieval loop. Thanks to @dbernheisel for the report. Closes #152.
Money v5.15.0
This is the changelog for Money v5.15.0 released on July 24th, 2023. For older changelogs please consult the release tag on GitHub
Enhancements
- Adds an option
:no_fraction_if_integertoMoney.to_string/2. Iftruthythis option will setfractional_digits: 0ifmoneyis an integer value. This may be helpful in cases where integer money amounts such asMoney.new(:USD, 1234)should be formatted as$1,234rather than$1,234.00.
Money v5.14.1
This is the changelog for Money v5.14.1 released on July 23rd, 2023. For older changelogs please consult the release tag on GitHub
Bug Fixes
Fix
Logger.warn/1warnings by moving toLogger.warning/1.Fix failing test case.
Money v5.14.0
This is the changelog for Money v5.14.0 released on April 29th, 2023. For older changelogs please consult the release tag on GitHub
Enhancements
- Adds
Money.integer?/1to return a boolean indicatng if a money amount is an integer value (ie has no significant fractional digits).
Money v5.13.0
This is the changelog for Money v5.13.0 released on April 28th, 2023. For older changelogs please consult the release tag on GitHub
Enhancements
Updates to ex_cldr version 2.37.0 which includes data from CLDR release 43
Tests now assume Decimal ~> 2.0 since the
Inspectprotocol implementation now emits executable code examples.
Money v5.12.4
This is the changelog for Money v5.12.4 released on March 30th, 2023. For older changelogs please consult the release tag on GitHub
Note ex_money 5.12.4 is supported on Elixir 1.10 and later versions only. It also requires ex_cldr_numbers 2.25 or later.
Bug Fixes
- Delegates http requests (used in exchange rates retrieval) to
Cldr.Http.get_with_headers/2. This centralizes all HTTP get requests for allex_cldr_*libraries to this one function which can then be reviewed and managed for security concerns.
Money v5.12.3
This is the changelog for Money v5.12.3 released on October 13th, 2022. For older changelogs please consult the release tag on GitHub
Note ex_money 5.12.3 is supported on Elixir 1.10 and later versions only. It also requires ex_cldr_numbers 2.25 or later.
Bug Fixes
- Fix
NaNandInfamount detection to be compatible with Decimal 1.x and 2.x. Thanks to @Lostkobrakai for the PR. Closes #144.
Money v5.12.2
This is the changelog for Money v5.12.2 released on October 13th, 2022. For older changelogs please consult the release tag on GitHub
Note ex_money 5.12.2 is supported on Elixir 1.10 and later versions only. It also requires ex_cldr_numbers 2.25 or later.
Bug Fixes
- Don't create "NaN" or "Inf" valued Money structs. Thanks for @coladarci for the report. Closes #143.
Money v5.12.1
This is the changelog for Money v5.12.1 released on August 27th, 2022. For older changelogs please consult the release tag on GitHub
Note ex_money 5.12.1 is supported on Elixir 1.10 and later versions only. It also requires ex_cldr_numbers 2.25 or later.
Bug Fixes
- Removes compile-time warnings for Elixir 1.14 (use
Application.compile_env/2, notApplication.get_env/2)
Money v5.12.0
This is the changelog for Money v5.12.0 released on June 8th, 2022. For older changelogs please consult the release tag on GitHub
Note ex_money 5.12.0 is supported on Elixir 1.10 and later versions only. It also requires ex_cldr_numbers 2.25 or later.
Enhancements
- Add
Money.localize/2to convert a money amount into the currency in affect for the given locale.
Money v5.11.0
This is the changelog for Money v5.11.0 released on May 14th, 2022. For older changelogs please consult the release tag on GitHub
Note ex_money 5.11.0 is supported on Elixir 1.10 and later versions only. It also requires ex_cldr_numbers 2.25 or later.
Enhancements
- Adds support for ISO 24165 Digital Tokens (crypto currency). Digital Token-based money behaves the same as currency-based money with the following exceptions due to limited data availability:
- Digital token names are not localized (there is no localised data available in CLDR)
- Digital token names are not pluralized (also because there is no localised data available)
- Digital token amounts are never rounded (there is no data available to standardise on rounding rules or the number of fractional digits to round to)
Money v5.10.0
This is the changelog for Money v5.10.0 released on April 6th, 2022. For older changelogs please consult the release tag on GitHub
Note ex_money 5.10.0 is supported on Elixir 1.10 and later versions only. It also requires ex_cldr_numbers 2.25 or later.
Enhancements
Add
Money.zero?/1,Money.positive?/1andMoney.negative?/1. Thanks to @emaiax for the PR.Update CLDR to release 41 in ex_cldr version 2.28.0 and ex_cldr_numbers 2.26.0.
Money v5.9.0
This is the changelog for Money v5.9.0 released on February 21st, 2022. For older changelogs please consult the release tag on GitHub
Note ex_money 5.9.0 is supported on Elixir 1.10 and later versions only. It also requires ex_cldr_numbers 2.25 or later.
Enhancements
Updates to ex_cldr version 2.26.0 and ex_cldr_numbers version 2.25.0 which use atoms for locale names and rbnf locale names. This is consistent with other elements of
t:Cldr.LanguageTagwhere atoms are used when the cardinality of the data is fixed and relatively small and strings where the data is free format.Adjusts the output of
Money.inspect/2to be executable code. Instead of#Money<:USD, 100>the output will beMoney.new(:USD, "100"). This improved developer experience by allowing for copy/paste ofinspect/2results intoiex. It is also in line with similar changes being made inelixir,Decimaland others.Add documentation for
:currency_symboloption forMoney.to_string/2. Although its an option that is passed through toCldr.Number.to_string/3, its very relevant tot:Moneyformatting.
Money v5.8.0
This is the changelog for Money v5.8.0 released on January 31st, 2022. For older changelogs please consult the release tag on GitHub
Note ex_money 5.8.0 is supported on Elixir 1.10 and later versions only. It also requires ex_cldr_numbers 2.23 or later.
Enhancements
- Adds configuration option
:exclude_protocol_implementationsto omit generating implementations for one or more protocols from the listJason.Encoder,JSON.Encoder,Phoneix.HTML.SafeandGringotts.Money. Thanks to @jgough-playoxygen for the suggestion.
Money v5.7.4
This is the changelog for Money v5.7.4 released on December 23rd, 2021. For older changelogs please consult the release tag on GitHub
Note ex_money 5.7.4 is supported on Elixir 1.10 and later versions only. It also requires ex_cldr_numbers 2.23 or later.
Bug Fixes
- Fix
Money.to_integer_exp/1whent:Moneyhas a negative amount. Thanks to @hamptokr for the report and the PR.
Money v5.7.3
This is the changelog for Money v5.7.3 released on December 19th, 2021. For older changelogs please consult the release tag on GitHub
Note ex_money 5.7.3 is supported on Elixir 1.10 and later versions only. It also requires ex_cldr_numbers 2.23 or later.
Bug Fixes
- Fixes retrieving exchange rates on OTP releases before OTP 22. Thanks to @fbettag for the report, collaboration and patience.
Money v5.7.2
This is the changelog for Money v5.7.2 released on December 17th, 2021. For older changelogs please consult the release tag on GitHub
Note ex_money 5.7.2 is supported on Elixir 1.10 and later versions only. It also requires ex_cldr_numbers 2.23 or later.
Bug Fixes
- Fix spec for
Money.from_integer/3. Thanks to @jdewar for the report.
Enhancements
- Support a
:fractional_digitsoption forMoney.from_integer/3and improve the documentation.
Money v5.7.1
This is the changelog for Money v5.7.1 released on December 8th, 2021. For older changelogs please consult the release tag on GitHub
Note ex_money 5.7.1 is supported on Elixir 1.10 and later versions only. It also requires ex_cldr_numbers 2.23 or later.
Bug Fixes
Fix dialyzer warnings on Elixir 1.12 and 1.13
Replace
use Mix.Configwithimport Configin configuration files since the former is deprecated.
Money v5.7.0
This is the changelog for Money v5.7.0 released on October 28th, 2021. For older changelogs please consult the release tag on GitHub
Enhancements
- Updates to support CLDR release 40 via ex_cldr version 2.24
Deprecations
- Don't call deprecated
Cldr.Config.get_locale/2, useCldr.Locale.Loader.get_locale/2instead.
Money v5.6.0
This is the changelog for Money v5.6.0 released on August 31st, 2021. For older changelogs please consult the release tag on GitHub
Enhancements
- Adds
Money.to_currency_code/1to return the currency code part of at:Money. Thanks to @Adzz for the proposal. Closes #130.
Money v5.5.5
This is the changelog for Money v5.5.5 released on August 15th, 2021. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Allow either
phoenix_htmlversion 2.x or 3.x. Thanks to @seantanly for the PR. Closes #129.
Money v5.5.4
This is the changelog for Money v5.5.4 released on June 17th, 2021. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Support
t:Cldr.Number.Format.Optionsas an argument toMoney.to_string/2. Thanks to @jeroenvisser101 for the PR. Closes #127.
Money v5.5.3
This is the changelog for Money v5.5.3 released on May 7th, 2021. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fixes parsing money when a currency string has a "." in it such as "kr.". Thanks for the report to @Doerge. Closes #125.
Money v5.5.2
This is the changelog for Money v5.5.2 released on April 14th, 2021. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix exception message when describing the requirement for a default backend configuration. Thanks to @holandes22 for the report. Closes #124.
Money v5.5.1
This is the changelog for Money v5.5.1 released on February 18th, 2021. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix formatting a
t:Moneythat has no:format_optionskey. That can happen if re-hydrating at:Moneyusing:erlang.binary_to_term/1from an older version ofex_moneythat doesn't have the:format_optionskey in the struct. Thanks to @coladarci. Fixes #123.
Money v5.5.0
This is the changelog for Money v5.5.0 released on February 10th, 2021. For older changelogs please consult the release tag on GitHub
Enhancements
Adds format options to
t:Moneyto allow per-money formatting options to be applied with theString.Charsprotocol. Thanks to @morinap for the feature request.
Money v5.4.1
This is the changelog for Money v5.4.1 released on January 7th, 2021. For older changelogs please consult the release tag on GitHub
Bug Fixes
Update
stream_datato remove stacktrace warningUse
Cldr.default_backend!/0instead of deprecatedCldr.default_backend/0in tests. Closes #120. Thanks to @darwintantuco.
Money v5.4.0
This is the changelog for Money v5.4.0 released on November 1st, 2020. For older changelogs please consult the release tag on GitHub
Enhancements
- Add support for CLDR 38
Money v5.3.2
This is the changelog for Money v5.3.2 released on September 30th, 2020. For older changelogs please consult the release tag on GitHub
Bug Fixes
Fix docs for
Money.div!/2Update
cldr_utilswhich implements a shim forDecimalto support both version1.9and2.0.
Money v5.3.1
This is the changelog for Money v5.3.1 released on September 26th, 2020. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Support
nimble_parsecversions that match~> 0.5 or ~> 1.0
Money v5.3.0
This is the changelog for Money v5.3.0 released on September 5th, 2020. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix parsing money amounts to use Unicode definition of whitespace (set
[:Zs:]). Thanks to @Sanjibukai for the report.
Enhancements
- Add
Money.sum/2to sum a list ofMoney, converting them if required.
Money v5.2.1
This is the changelog for Money v5.2.1 released on June 23rd, 2020. For older changelogs please consult the release tag on GitHub
Enhancements
Configure the
Money.Applicationsupervisor via the arguments toMoney.Application.start/2and configure defaults inmix.exs. This permits different restart strategies and names.Add
Money.ExchangeRates.Supervisor.default_supervisor/0to return the name of the default supervisor which isMoney.SupervisorChange
Money.ExchangeRates.Supervisor.stop/0to becomeMoney.ExchangeRates.Supervisor.stop/{0, 1}allowing the supervisor name to be passed in. The default isMoney.ExchangeRates.Supervisor.default_supervisor/0
Bug Fixes
- Add back the name of the Application supervisor,
Money.Supervisor. Thanks for the report of the regression to @jeroenvisser101. Fixes #117.
Money v5.2.0
This is the changelog for Money v5.2.0 released on May 30th, 2020. For older changelogs please consult the release tag on GitHub
Enhancements
- Adds a configuration option
:verify_peerwhich is a boolean that determines whether to verify the client certificate for any exchange rate service API call. The default istrue. This option should not be changed without a very clear understanding of the security implications. This option will remain undocumented but supported for now.
Bug fixes
- Handle expired certificate errors on the exchange rates API service and log them. Thanks to @coladarci. Fixes #116
Money v5.1.0
This is the changelog for Money v5.1.0 released on May 26th, 2020. For older changelogs please consult the release tag on GitHub
Enhancements
Extract default currency from locale when calling
Money.parse/2on a money string. The updated docs now say::default_currencyis any valid currency code orfalsethat will used if no currency code, symbol or description is indentified in the parsed string. The default isnilwhich means that the default currency associated with the:localeoption will be used. Iffalsethen the currency assocated with the:localeoption will not be used and an error will be returned if there is no currency in the string being parsed.
Add certificate verification for exchange rate retrieval
Money v5.0.2
This is the changelog for Money v5.0.2 released on April 29th, 2020. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Update the application supervisor spec
Money v5.0.1
This is the changelog for Money v5.0.1 released on January 28th, 2020. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Make
nimble_parseca required dependency since it is required for parsing money amounts. Thanks to @jonnystoten for the report.
Money v5.0.0
This is the changelog for Money v5.0.0 released on January 21st, 2020. For older changelogs please consult the release tag on GitHub
Breaking changes
Elixir 1.10 introduces semantic sorting for stucts that depends on the availability of a
compare/2function that returns:lt,:eqor:gt. Therefore in this release ofex_moneythe functionscompare/2andcompare!/2are swapped withcmp/2andcmp!/2in order to conform with this expectation. Nowcompare/2will return:eq,:ltor:gt. Andcmp/2return-1,0or1.Deprecate
Money.reduce/1in favour ofMoney.normalize/1to be consistent withDecimalversions1.9and later.
It is believed and tested that Money version 5.0.0 is compatible with all versions of Decimal from 1.6 up to the as-yet-unreleased 2.0.
Support of Elixir 1.10 Enum sorting
From Elixir verison 1.10.0, several functions in the Enum module can use the Money.compare/2 function to simplify sorting. For example:
iex> list = [Money.new(:USD, 100), Money.new(:USD, 200)]
[#Money<:USD, 100>, #Money<:USD, 200>]
iex> Enum.sort list, Money
[#Money<:USD, 100>, #Money<:USD, 200>]
iex> Enum.sort list, {:asc, Money}
[#Money<:USD, 100>, #Money<:USD, 200>]
iex> Enum.sort list, {:desc, Money}
[#Money<:USD, 200>, #Money<:USD, 100>]Note that Enum.sort/2 will sort money amounts even when the currencies are incompatible. In this case the order of the result is not predictable. It is the developers responsibility to filter the list to compatible currencies prior to sorting. This is a limitation of the Enum.sort/2 implementation.
Notes on Decimal version support
ex_moneyversion5.0.0is compatible withDecimalversions from1.6onwards. InDecimalversion2.0the same changes tocompare/2andcmp/2will occur and inDecimalversion1.9,Decimal.cmp/2is deprecated.ex_moneyversion5.0.0detects these different versions ofDecimaland therefore remains compatability withDecimalback to version1.6.
Money v4.4.2
This is the changelog for Money v4.4.2 released on January 2nd, 2020. For older changelogs please consult the release tag on GitHub
Bug Fixes
Remove calls to
Code.ensure_compiled?/1since it is deprecated in Elixir 1.10. Use insteadCldr.Config.ensure_compiled?/1which is added as a private API inCldrversion 2.12.0. This version ofCldrnow becomes the minimum version required.Remove spurious entries in
.dialyzer_ignore_warnings- no entries are required and dialyzer is happy.
Money v4.4.1
This is the changelog for Money v4.4.1 released on November 10th, 2019. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fixes money parsing error. Thanks to @Doerge. Closes #112.
Money v4.4.0
This is the changelog for Money v4.4.0 released on November 6th, 2019. For older changelogs please consult the release tag on GitHub
Breaking Change
Money.parse/2until this release supported the:currency_filteroption. It allowed for currencies to be filtered based upon their attributes (:all,:current,:historic,:tender,:annotated). When multiple attributes were passed in a list, a currency had to meet all of these attributes. From this release onwards, multiple attributes items areored, notanded. It is expected this option is used extremely rarely and therefore of limited impact.
Enhancements
Money.parse/2now includes the option:default_currencywhich allows for parsing a number only (without a currency code) and it will be tagged with the:default_currency.iex> Money.parse("100") {:error, {Money.Invalid, "A currency code, symbol or description must be specified but was not found in \"100\""}} iex> Money.parse("100", default_currency: :USD) #Money<:USD, 100>Add
:onlyand:exceptoptions toMoney.parse/2to specify which currency codes or currency attributes are permitted.:onlyand:exceptreplace the option:currency_filterwhich is now deprecated. If provided,:currency_filteris interpreted as:only. An example:iex> Money.parse("100 usd", only: :current, except: :USD) {:error, {Money.UnknownCurrencyError, "The currency \"usd\" is unknown or not supported"}}Money.parse/2now supports negative money amounts.iex> Money.parse("chf -100") #Money<:CHF, -100> iex> Money.parse("(chf 100)") #Money<:CHF, -100>The money parser has been rewritten using nimble_parsec
Money v4.3.0
This is the changelog for Money v4.3.0 released on September 8th, 2019. For older changelogs please consult the release tag on GitHub
Enhancements
- Adds a
Moneybackend in the same spirit as other libraries that leverge ex_cldr. Thanks to @Lostkobrakai. Closes #108. All of the functions in theMoneymodule may also be called on a backend module<backend>.Money.funwithout having to specify a backend module since this is implicit.
Bug Fixes
Money.new!/3replacesMoney.new!/2to accept options. Thanks to @Lostkobrakai. Closes #109.
Money v4.2.2
This is the changelog for Money v4.2.2 released on September 7th, 2019. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Use
Keyword.get_lazywhen the default isCldr.default_backend/0to avoid exceptions when no default backend is configured. Thanks to @Lostkobrakai. Closes #108.
Money v4.2.1
This is the changelog for Money v4.2.1 released on September 2nd, 2019. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fixes parsing of money amount that have a single digit amount. Closes #107. Thanks to @njwest
Money v4.2.0
This is the changelog for Money v4.2.0 released on 21 August, 2019. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Move the
Money.Migrationmodule to ex_money_ecto where it belongs
Enhancements
Money.default_backend/0will now either use the backend configured under the:default_cldr_backendkey ofex_moneyorCldr.default_backend/0. In either case an exeption will be raised if no default backend is configured.
Money v4.1.0
This is the changelog for Money v4.1.0 released on July 13th, 2019. For older changelogs please consult the release tag on GitHub
Enhancements
Adds
Money.abs/1. Thanks to @jeremyjh.Improve
@docconsistency using## Argumentsnot## Options.
Money v4.0.0
This is the changelog for Money v4.0.0 released on July 8th, 2019. For older changelogs please consult the release tag on GitHub
Breaking Changes
Functions related to the serialization of money types have been extracted to the library ex_money_sql. For applications using the dependency
ex_moneythat do not require serialization no changes are required. For applications using serialization, the dependency should be changed toex_money_sql(which in turn depends onex_money).Supports Elixir 1.6 and later only
Money v3.4.4
This is the changelog for Money v3.4.4 released on June 2nd, 2019. For older changelogs please consult the release tag on GitHub
Enhancements
- Supports passing an
Cldr.Number.Formation.Options.tas alternative to aKeyword.tfor options toMoney.to_string/2. Performance is doubled when using pre-validated options which is useful if formatting is being executed in a tight loop.
An example of this usage is:
iex> money = Money.new(:USD, 100)
# Apply any options required as a keyword list
# Money will take care of managing the `:currency` option
iex> options = []
iex> {:ok, options} = Cldr.Number.Format.Options.validate_options(0, backend, options)
iex> Money.to_string(money, options)The 0 in validate_options is used to determine the sign of the amount because that can influence formatting - for example the accounting format often uses (1234) as its format. If you know your amounts are always positive, just use 0.
If the use case may have both positive and negative amounts, generate two option sets (one with the positive number and one with the negative). Then use the appropriate option set. For example:
iex> money = Money.new(:USD, 1234)
# Add options as required
# Money will take care of managing the `:currency` option
iex> options = []
iex> {:ok, positive_options} = Cldr.Number.Format.Options.validate_options(0, backend, options)
iex> {:ok, negative_options} = Cldr.Number.Format.Options.validate_options(-1, backend, options)
iex> if Money.cmp(money, Money.zero(:USD)) == :gt do
...> Money.to_string(money, positive_options)
...> else
...> Money.to_string(money, negative_options)
...> endMoney v3.4.3
This is the changelog for Money v3.4.3 released on June 2nd, 2019. For older changelogs please consult the release tag on GitHub
Bug Fixes
Ensure
Money.to_string!/2properly raisesAdd specs for
Money.to_string/2andMoney.to_string!/2
Thanks to @rodrigues for the report and PR.
Money v3.4.2
This is the changelog for Money v3.4.2 released on April 16th, 2019. For older changelogs please consult the release tag on GitHub
Bug Fixes
Money.put_fraction/2now correctly allows setting the fraction to 0.
Enhancements
Money.round/2allows setting:currency_digitsto an integer number of digits in addition to the options:iso,:cashand:accounting. The default remains:iso.Improves the documentation for
Money.to_string/2.
Money v3.4.1
This is the changelog for Money v3.4.1 released on April 5th, 2019. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix
README.mdmarkdown formatting error. Thanks to @fireproofsocks for the report and @lostkobrakai for the fix. Closes #99.
Money v3.4.0
This is the changelog for Money v3.4.0 released on March 28th, 2019. For older changelogs please consult the release tag on GitHub
Enhancements
- Updates to CLDR version 35.0.0 released on March 27th 2019 through
ex_cldrversion 2.6.0.
Money v3.3.1
This is the changelog for Money v3.3.1 released on March 8th, 2019. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix or silence dialyzer warnings
Money v3.3.0
This is the changelog for Money v3.3.0 released on February 24th, 2019. For older changelogs please consult the release tag on GitHub
Enhancements
- Adds
Money.put_fraction/2. This will set the fractional part of a money to the specified integer amount. Examples:iex> Money.put_fraction Money.new(:USD, "2.49"), 99 #Money<:USD, 2.99> iex> Money.put_fraction Money.new(:USD, "2.49"), 999 {:error, {Money.InvalidAmountError, "Rounding up to 999 is invalid for currency :USD"}}
Bug Fixes
- Parsing money strings now uses a more complete set of character definitions for decimal and grouping separators based upon the
characters.jsonfile of the "en" locale.
Money v3.2.4
This is the changelog for Money v3.2.4 released on February 13th, 2019. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Updates to ex_cldr_currencies version 2.1.2 which correctly removes duplicate currency strings when the same string referred to different currency codes. See the changelog for further detail.
Enhancements
- Adds a
:fuzzyoption toMoney.parse/2that usesString.jaro_distance/2to help determine if the provided currency text can be resolved as a currency code. For example:iex> Money.parse("100 eurosports", fuzzy: 0.8) #Money<:EUR, 100> iex> Money.parse("100 eurosports", fuzzy: 0.9) {:error, {Money.Invalid, "Unable to create money from \\"eurosports\\" and \\"100\\""}}
Money v3.2.3
This is the changelog for Money v3.2.3 released on February 12th, 2019. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Correctly parse money strings with unicode currency symbols like "€". Closes #95. Thanks to @crbelaus.
Money v3.2.2
This is the changelog for Money v3.2.2 released on February 10th, 2019. For older changelogs please consult the release tag on GitHub
Enhancements
- Improves parsing of money strings. Parsing now uses various strings that CLDR knows about. Some examples:
iex> Money.parse "$au 12 346", locale: "fr"
#Money<:AUD, 12346>
iex> Money.parse "12 346 dollar australien", locale: "fr"
#Money<:AUD, 12346>
iex> Money.parse "A$ 12346", locale: "en"
#Money<:AUD, 12346>
iex> Money.parse "australian dollar 12346.45", locale: "en"
#Money<:AUD, 12346.45>
iex> Money.parse "AU$ 12346,45", locale: "de"
#Money<:AUD, 12346.45>
# Can also return the strings available for a given currency
# and locale
iex> Cldr.Currency.strings_for_currency :AUD, "de"
["aud", "au$", "australischer dollar", "australische dollar"]
# Round trip formatting also seems to be ok
iex> {:ok, string} = Cldr.Number.to_string 1234, Money.Cldr, currency: :AUD
iex> Money.parse string
#Money<:AUD, 1234.00>Money v3.2.1
This is the changelog for Money v3.2.1 released on February 2nd, 2019. For older changelogs please consult the release tag on GitHub
Bug Fixes
Added
Money.Ecto.Composite.Type.cast/1andMoney.Ecto.Map.Type.cast/1for aString.tparameter. When aString.tis provided,cast/1will callMoney.parse/2to create theMoney.t.Money.new/3now uses the current locale on the default backend if no locale or backend is specified. This means thatMoney.Ecto.Composite.Type.cast/1andMoney.Ecto.Map.Type.cast/1will be parsed using the locale that has been set for the current process in the default backend. As a result, a simpletype=textform field can be used to input a money type (currency code and amount in a single string) that can then be cast to aMoney.t.
Money v3.2.0
This is the changelog for Money v3.2.0 released on February 1st, 2019. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Correctly generate
migrations_path/1function based upon whetherEctois configured and which version
Enhancements
- Adds
Money.parse/2which will parse a string comprising a currency code and an amount. It will return aMoney.tor an error. This function may be helpful in supporting money input in HTML forms.
Money v3.1.0
This is the changelog for Money v3.1.0 released on December 30th, 2018. For older changelogs please consult the release tag on GitHub
Bug Fixes
Fix typo in
exchange_rates_retriever.ex. Thanks to @lostkobrakai. Closes #91.Remove obsolete
cldrcompilerChanges the
sumaggregate function formoney_with_currencyto beSTRICTwhich means it handlesNULLcolumns in the same way as the standardSUMfunction. Thanks to @lostkobrakai. Closes #88.Fixes documentation link errors
Fix unhandled terminate typo error in exchange rates server. Thanks to @xavier. Closes #90.
Money v3.0.0
This is the changelog for Money v3.0.0 released on November 23rd, 2018. For older changelogs please consult the release tag on GitHub
The primary purpose of this release is to support ex_cldr version 2.0
Breaking changes
Money.from_tuple/1has been removed- Uses ex_cldr version 2. Please see the changelog for configuration changes that are required.
- Requires a default_cldr_backend to be configured in
config.exs. For example:config :ex_money, ... default_cldr_backend: MyApp.Cldr end