[Enhancement] Add history table to homepage (And TZ support) (#229)

* Added basic history table to homepage

* Improved homepage history query

* Set table to use 24h time

* Added timezone support

* Updated README to reflect new TZ stuff
This commit is contained in:
Kieran authored and GitHub committed 2024-05-07 12:16:57 -07:00
1 parent 1b7fb6d14b
commit a1a568b7f7
10 files changed
+165 -7

No files matched your search

@@ -78,4 +78,17 @@ defmodule PinchflatWeb.CustomComponents.TextComponents do
<span><%= @text %></span>
"""
end
@doc """
Renders a UTC datetime in the specified format and timezone
"""
attr :datetime, :any, required: true
attr :format, :string, default: "%Y-%m-%d %H:%M:%S"
attr :timezone, :string, default: Application.compile_env(:pinchflat, :timezone)
def datetime_in_zone(assigns) do
~H"""
<time><%= Calendar.strftime(Timex.Timezone.convert(@datetime, @timezone), @format) %></time>
"""
end
end