Skip to content

Commit

Permalink
Updated compile-time value to be runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
kieraneglin committed May 7, 2024
1 parent 9eded87 commit 1c2b867
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,12 @@ defmodule PinchflatWeb.CustomComponents.TextComponents do
"""
attr :datetime, :any, required: true
attr :format, :string, default: "%Y-%m-%d %H:%M:%S"
attr :timezone, :string, default: Application.compile_env(:pinchflat, :timezone)
attr :timezone, :string, default: nil

def datetime_in_zone(assigns) do
timezone = assigns.timezone || Application.get_env(:pinchflat, :timezone)
assigns = Map.put(assigns, :timezone, timezone)

~H"""
<time><%= Calendar.strftime(Timex.Timezone.convert(@datetime, @timezone), @format) %></time>
"""
Expand Down

0 comments on commit 1c2b867

Please sign in to comment.