Releases: kipcole9/money
Money version 3.4.0
Enhancements
- Updates to CLDR version 35.0.0 released on March 27th 2019 through
ex_cldr
version 2.6.0.
Money version 3.3.1
Bug Fixes
- Fix or silence dialyzer warnings
Money version 3.3.0
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.json
file of the "en" locale.
Money version 3.2.4
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
:fuzzy
option toMoney.parse/2
that usesString.jaro_distance/2
to 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 version 3.2.3
Money version 3.2.2
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
{:ok, "A$1,234.00"}
iex> Money.parse string
#Money<:AUD, 1234.00>
Money version 3.2.1
Bug Fixes
-
Added
Money.Ecto.Composite.Type.cast/1
andMoney.Ecto.Map.Type.cast/1
for aString.t
parameter. When aString.t
is provided,cast/1
will callMoney.parse/2
to create theMoney.t
. -
Money.new/3
now uses the current locale on the default backend if no locale or backend is specified. This means thatMoney.Ecto.Composite.Type.cast/1
andMoney.Ecto.Map.Type.cast/1
will be parsed using the locale that has been set for the current process in the default backend. As a result, a simpletype=text
form 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 version 3.2.0
Bug Fixes
- Correctly generate
migrations_path/1
function based upon whetherEcto
is configured and which version
Enhancements
- Adds
Money.parse/2
which will parse a string comprising a currency code and an amount. It will return aMoney.t
or an error. This function may be helpful in supporting money input in HTML forms.
Money version 3.1.0
Bug Fixes
-
Fix type in
exchange_rates_retriever.ex
. Thanks to @LostKobrakai. Closes #91. -
Remove obsolete
cldr
compiler -
Changes the
sum
aggregate function formoney_with_currency
to beSTRICT
which means it handlesNULL
columns in the same way as the standardSUM
function. Thanks to @LostKobrakai. Closes #88. -
Fixes documentation link errors
-
Fix unhandled terminate typo error in exchange rates server. Thanks to @xavier. Closes #90.
Money version 3.0.0
Changelog for 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/1
has 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