elixir-cldr / cldr_dates_times

Date & times formatting functions for the Common Locale Data Repository (CLDR) package https://github.com/elixir-cldr/cldr
Other
69 stars 13 forks source link

no case clause matching: :error in 2.13.3 #36

Closed woylie closed 1 year ago

woylie commented 1 year ago

This works in ex_cldr_dates_times 2.13.2:

iex(1)> MyAppWeb.Cldr.Date.Interval.to_string!(~D[2022-11-19], ~D[2022-12-11], format: :medium)
"2022年11月19日~12月11日"

However, in version 2.13.3, I'm getting this:

iex(1)> MyAppWeb.Cldr.Date.Interval.to_string!(~D[2022-11-19], ~D[2022-12-11], format: :medium)
** (CaseClauseError) no case clause matching: :error
    (ex_cldr_dates_times 2.13.3) lib/cldr/interval/date.ex:644: Cldr.Date.Interval.to_string!/4

ex_cldr version: 2.36.0

kipcole9 commented 1 year ago

Ouch, that's not good. My apologies. Can you please confirm which locale is in effect? I'll work on this right away.

woylie commented 1 year ago

It's ja. But I'm not sure right now whether that's a bug indeed, or whether the compiler is just stubborn.

woylie commented 1 year ago

It seems to work now after deleting the _build folder and the locale data file.

kipcole9 commented 1 year ago

Hmmm, I'm seeing the following:

iex> MyApp.Cldr.Date.Interval.to_string!(~D[2022-11-19], ~D[2022-12-11], format: :medium, locale: "ja")
"2022年11月19日~12月11日"

But I do get the error if I use an older version of ex_cldr:

iex> MyApp.Cldr.Date.Interval.to_string!(~D[2022-11-19], ~D[2022-12-11], format: :medium, locale: "ja")
** (CaseClauseError) no case clause matching: :error
    (ex_cldr_dates_times 2.13.3) lib/cldr/interval/date.ex:644: Cldr.Date.Interval.to_string!/4
    iex:2: (file)

So my working assumption is that you're on Linux, and for reasons I still can't work out, the old locale files are persisting even when a new version of ex_cldr is installed. I will fix this in April with CLDR 43 by versioning the locale data files.

woylie commented 1 year ago

I am on macOS, actually.

kipcole9 commented 1 year ago

Arrrghhhh, that's even worse (from my perspective) since I do all my work on Macs and this has never been an issue for me other than on isolated Linux instances. Would you mind pasting the configuration you have for MyAppWeb.Cldr? I'm still trying to reproduce how on earth this can happen.

woylie commented 1 year ago

Sure, this is my backend module:

defmodule MyAppWeb.Cldr do
  @moduledoc false

  use Cldr,
    locales: ["ja", "en"],
    gettext: MyAppWeb.Gettext,
    otp_app: :my_app_web,
    providers: [Cldr.Calendar, Cldr.DateTime, Cldr.List, Cldr.Number, Cldr.Unit]
end