Skip to content

Releases: kipcole9/money

Money version 3.2.2

10 Feb 01:16
Compare
Choose a tag to compare

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

01 Feb 18:54
Compare
Choose a tag to compare

Bug Fixes

  • Added Money.Ecto.Composite.Type.cast/1 and Money.Ecto.Map.Type.cast/1 for a String.t parameter. When a String.t is provided, cast/1 will call Money.parse/2 to create the Money.t.

  • Money.new/3 now uses the current locale on the default backend if no locale or backend is specified. This means that Money.Ecto.Composite.Type.cast/1 and Money.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 simple type=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 a Money.t.

Money version 3.2.0

01 Feb 14:26
Compare
Choose a tag to compare

Bug Fixes

  • Correctly generate migrations_path/1 function based upon whether Ecto 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 a Money.t or an error. This function may be helpful in supporting money input in HTML forms.

Money version 3.1.0

30 Dec 12:06
Compare
Choose a tag to compare

Bug Fixes

  • Fix type in exchange_rates_retriever.ex. Thanks to @LostKobrakai. Closes #91.

  • Remove obsolete cldr compiler

  • Changes the sum aggregate function for money_with_currency to be STRICT which means it handles NULL columns in the same way as the standard SUM 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

22 Nov 19:38
Compare
Choose a tag to compare

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

Money version 2.12.2

22 Oct 22:09
Compare
Choose a tag to compare

Bug Fixes

  • Sometimes Mix.Dep.cached/0 returns a structure which doesn't identify the version of the dependency loaded. Therefore in this version we just check if the function Ecto.Migrator.migrations_path/0 exists. Thanks to @hl for the issue. Closes #86.

Money version 2.12.1

22 Oct 05:58
Compare
Choose a tag to compare

Bug Fixes

  • Fixed error which assumed that Mix.Dep.loaded_by_name/2 was renamed in Elixir 1.6 but in fact it was renamed to Mix.Dep.loaded_by_name/2 in Elixir 1.7.

  • Fix and error in defining compiler paths for tests to ensure compatibility for Elixir 1.5, 1.6 and 1.7

Money version 2.12.0

22 Oct 02:42
Compare
Choose a tag to compare

Enhancements

Supports Ecto version 3.x (ecto_sql) release candidate. When upgrading from Ecto 2 to Ecto 3 the following configuration changes are applied:

In config.exs you would likely have:

defp deps do
  [
    {:ecto, "~> 2.1"},
    {:postgrex, "> 0.0.0"},
    {:ex_money, "~> 2.6"},
    {:jason, "~> 1.0"}
    ...
  ]
end

With Ecto 3 (ecto_sql) the configuration would be:

# Change to the release versions when
# available on hex
defp deps do
  [
    {:ecto_sql, "~> 3.0-rc"},
    {:postgrex, "~> 0.14-rc"},
    {:ex_money, "~> 2.12"},
    {:jason, "~> 1.0"}
    ...
  ]
end

Note that :ecto_sql uses :db_connection version 2.0 which has its own connection pooling and :poolboy is no longer required.

Money version 2.11.0

17 Oct 22:03
Compare
Choose a tag to compare

Enhancements

  • Updated dependency on ex_cldr to version 1.8 which uses CLDR version 34 data.

Money version 2.10.0

16 Oct 23:05
Compare
Choose a tag to compare

Enhancements

Adds an optional parameter options to Money.new/2 which is now Money.new/3. options is a keyword list of options. Only one option is valid, :locale which, if specified must be in Cldr.known_locales The locale is used to transform any binary amounts passed to Money.new/3 such that localised grouping characters and decimal characters are normalised to the Elixir requirements. For example before this change the following example would error because the decimal point is a separator in the "de" locale and the decimal character , is invalid in Elixir number literals.

iex> Money.new("1.000,99", :EUR)
{:error, {Money.InvalidAmountError, "Amount cannot be converted to a number: \"1.000,99\""}}

Using the :locale parameter it is now possible to specify the locale transform for number string literals:

iex> Money.new("1.000,99", :EUR, locale: "de")
#Money<:EUR, 1000.99>

Thanks to @f34nk for the suggestion.