However, Cldr.DateTime.to_string/2 doesn’t accept #DateTime<...>:
iex> {:ok, result} = Cldr.DateTime.to_string(shifted, "en-GB")
** (MatchError) no match of right hand side value: {:error, {ArgumentError, "Invalid DateTime. DateTime is a map that contains at least :year, :month, :day, :hour, :minute, :second and :calendar. Found: #DateTime<2024-07-13 23:33:23.163097+02:00 CEST Europe/Berlin Cldr.Calendar.Gregorian>"}}
(stdlib 4.3.1.3) erl_eval.erl:496: :erl_eval.expr/6
iex:3: (file)
I don’t know what #...<...> means, exactly, or how to convert it to a DateTime struct/map that Cldr.DateTime can use. Thanks.
@dimitarvp, @LostKobrakai, thanks. So the use of # seems to be related to a comment marker, as the representation is not valid Elixir syntax. In 1.17’s documentation: Inspect — Elixir v1.17.2. That mentions that #Name<...> tends to be used when there are private fields to hide. I guess in the case of DateTime it’s used for conciseness.
@kip, thanks, and thanks very much for your libraries!