Closed sysashi closed 4 months ago
or expect it to convert it for me automatically (Calendar.ISO -> Cldr.Calendar.Gregorian)
Yes, you absolutely should expect ex_cldr_calendars
and ex_cldr_dates_times
to take care of that for you. It's definitely a bug. Sorry for the inconvenience - I'll get this fixed and a new release out within the next 24 hours.
I have published ex_cldr_dates_times version 2.18.1 with the following changelog entry:
am/pm
with format :narrow
or :wide
. Thanks to @sysashi for the report. Closes #48.Thanks for the report!
BTW, just noting what the docs say about MyApp.Cldr.DateTime.Formatter.format/4
NOTE This function is called by Cldr.Date.to_string/2, Cldr.Time.to_string/2 and Cldr.DateTime.to_string/2 which is the preferred API.
Got it, thank you @kipcole9, completely missed that note.. :( for some reason I was always assuming using <my-app>.Cldr
is better since I dont have to pass backend option. Will use the proper api
Oh my bad. Totally ok and even more preferred to use MyApp.Cldr.{Date, Time, DateTime}.to_string/2
! I'll make the note clearer.
Failing example:
It seems like the underlying
Cldr.Calendar.localize/6
function grabs calendar from passed date_time, which for native date time would beCalendar.ISO
(DateTime.utc_now().calendar # => Calendar.ISO
)Question is: Should I convert datetime to cldr calendar or expect it to convert it for me automatically (
Calendar.ISO -> Cldr.Calendar.ISO
) or maybe there is something else entirely