removing timex in favor of main library functions

This commit is contained in:
Adam Piontek 2021-03-06 00:42:13 -05:00
commit 5c4ae401d9
4 changed files with 7 additions and 4 deletions
lib/shift73k/util

View file

@ -2,9 +2,9 @@ defmodule Shift73k.Util.Dt do
@app_vars Application.get_env(:shift73k, :app_global_vars, time_zone: "America/New_York")
@time_zone @app_vars[:time_zone]
def ndt_to_local(%NaiveDateTime{} = ndt), do: Timex.to_datetime(ndt, @time_zone)
def ndt_to_local(%NaiveDateTime{} = ndt), do: DateTime.from_naive(ndt, @time_zone)
def format_dt_local(dt_local, fstr), do: Timex.format!(dt_local, fstr)
def format_dt_local({:ok, dt_local}, fstr), do: Calendar.strftime(dt_local, fstr)
def format_ndt(%NaiveDateTime{} = ndt, fstr), do: ndt |> ndt_to_local() |> format_dt_local(fstr)
end