You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function do_handle_datetime/3 uses DateTime.from_naive/3 to convert datetimes from naive to utc. Elixir by default does not ship with a timezone db, so attempting to use this function without a timezone database installed gives an error of {:error, :utc_only_time_zone_database} which then causes the function to crash.
Solutions to prevent crashing:
Add a clause to do_handle_datetime/3 handle the {:error, :utc_only_time_zone_database} output of DateTime.from_naive/3.
Add a clause to handle the likewise unhandled output {:error, :incompatible_calendars}
Solutions for timezone dependency:
Add a timezone database as strict dependency e.g. tzdata OR
Instruct the user to install a timezone dependency.
The text was updated successfully, but these errors were encountered:
I guess the first one should stick to crashing as the library is not intended to be used without a timezone database configured (which should however be documented) and for the second one I guess it makes sense to use an optional callback. For as long as the input_datetime is cast by ecto I'm not sure it can even be in a calendar different to Calendar.ISO.
The function
do_handle_datetime/3
usesDateTime.from_naive/3
to convert datetimes from naive to utc. Elixir by default does not ship with a timezone db, so attempting to use this function without a timezone database installed gives an error of{:error, :utc_only_time_zone_database}
which then causes the function to crash.Solutions to prevent crashing:
do_handle_datetime/3
handle the{:error, :utc_only_time_zone_database}
output ofDateTime.from_naive/3
.{:error, :incompatible_calendars}
Solutions for timezone dependency:
tzdata
ORThe text was updated successfully, but these errors were encountered: