removing timex in favor of main library functions
This commit is contained in:
parent
ed98c03fae
commit
5c4ae401d9
4 changed files with 7 additions and 4 deletions
lib/shift73k/util
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue