diff --git a/CHANGELOG.md b/CHANGELOG.md index a7b2651..7759c2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,20 @@ **When upgrading from `ex_money_sql` version `1.3.x` to `1.4.x` and later, please read the important migration information in the [README](/ex_money_sql/readme.html#migrating-from-money-sql-versions-1-3-or-earlier)** +**Note** That `money_sql` is supported on Elixir 1.11 and later only from ex_money_sql version 1.7.0. + +## Money_SQL v1.7.3 + +This is the changelog for Money_SQL v1.7.3 released on December 18th, 2022. + +## Bug Fixes + +* WHen loading money from the database with the `Money.Ecto.Map.Type` type, do not do localized parsing of the amount. The amount is always saved using `Decimal.to_string/1` and therefore is not localized. It must not be parsed with localization on loading. + ## Money_SQL v1.7.2 This is the changelog for Money_SQL v1.7.2 released on August 27th, 2022. -**Note** That `money_sql` is now supported on Elixir 1.11 and later only. - ## Bug Fixes * Makes the aggregate functions parallel-safe which provides up to 100% speed improvement. Thanks to @milangupta1 for the PR. @@ -16,8 +24,6 @@ This is the changelog for Money_SQL v1.7.2 released on August 27th, 2022. This is the changelog for Money_SQL v1.7.1 released on July 8th, 2022. -**Note** That `money_sql` is now supported on Elixir 1.11 and later only. - ## Bug Fixes * Fixes casting a money map when the currency is `nil`. Thanks to @frahugo for the report. Closes #24. @@ -26,8 +32,6 @@ This is the changelog for Money_SQL v1.7.1 released on July 8th, 2022. This is the changelog for Money_SQL v1.7.0 released on May 21st, 2022. -**Note** That `money_sql` is now supported on Elixir 1.11 and later only. - ## Enhancements * Adds the module `Money.Validation` to provide [Ecto Changeset validations](https://hexdocs.pm/ecto/Ecto.Changeset.html#module-validations-and-constraints). In particular it adds `Money.Validation.validate_money/3` which behaves exactly like `Ecto.Changeset.validate_number/3` only for `t:Money.t/0` types. diff --git a/mix.exs b/mix.exs index af0b013..7521a57 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Money.Sql.Mixfile do use Mix.Project - @version "1.7.2" + @version "1.7.3" def project do [ diff --git a/test/money_ecto_test.exs b/test/money_ecto_test.exs index 817f94a..47931d1 100644 --- a/test/money_ecto_test.exs +++ b/test/money_ecto_test.exs @@ -45,6 +45,18 @@ defmodule Money.Ecto.Test do assert Money.Ecto.Map.Type.dump(Money.new(:USD, 100)) == {:ok, %{"amount" => "100", "currency" => "USD"}} end + + test "dump and loade a money struct when the locale uses non-default separators" do + Cldr.with_locale("de", Test.Cldr, fn -> + money = Money.new(:USD, "100,34") + dumped = Money.Ecto.Map.Type.dump(money) + assert dumped == {:ok, %{"amount" => "100.34", "currency" => "USD"}} + + cast = Money.Ecto.Map.Type.load(elem(dumped, 1)) + assert cast == {:ok, money} + end) + end + end for ecto_type_module <- [Money.Ecto.Composite.Type, Money.Ecto.Map.Type] do