cldr
cldr copied to clipboard
Breaking change (for me) in 2.41.0 re: Time formats
I upgraded from 2.40.3 to 2.41.0 which according to Semver should have been backwards compatible IIRC.
however I had code :
defp default_full_format(locale) do
{:ok, date_formats} = Format.date_formats(locale, :gregorian)
{:ok, time_formats} = Format.time_formats(locale, :gregorian)
IO.inspect(date_formats)
IO.inspect(time_formats)
"EEEE, " <> date_formats.long <> ", " <> time_formats.short <> " z"
end
which broke with an "Argument Error" (not easy to find).
I narrowed the issue to the fact that in 2.40 the Time format was:
%Cldr.Time.Formats{
short: "h:mm a",
medium: "h:mm:ss a",
long: "h:mm:ss a z",
full: "h:mm:ss a zzzz"
}
and in 2.41 the time formats are:
%Cldr.Time.Formats{
short: %{unicode: "h:mm a", ascii: "h:mm a"},
medium: %{unicode: "h:mm:ss a", ascii: "h:mm:ss a"},
long: %{unicode: "h:mm:ss a z", ascii: "h:mm:ss a z"},
full: %{unicode: "h:mm:ss a zzzz", ascii: "h:mm:ss a zzzz"}
}
Which of course turned a binary into a map.
I am open to the fact that I was "dependent" on the format of the Cldr.Time.Formats - which one could infer I was using when I should not???.
Just wanted to make @kipcole9 aware that this was a breaking change for one of the users of this library. Easily "fixed".