Browse Source

feat: show weekday in forecast

tags/v0.68.0
Inhji Y. 1 week ago
parent
commit
402ff09883
2 changed files with 8 additions and 0 deletions
  1. +1
    -0
      apps/tomie_web/lib/tomie_web/templates/page/index.html.leex
  2. +7
    -0
      apps/tomie_web/lib/tomie_web/views/page_view.ex

+ 1
- 0
apps/tomie_web/lib/tomie_web/templates/page/index.html.leex View File

@@ -24,6 +24,7 @@
<div class="image w-16 flex-shrink-0">
<img src="<%= weather_icon_path(day) %>" class="w-full" title="<%= day.pretty.description %>">
<div class="text-center">
<div><strong><%= weekday(day.dt) %></strong></div>
<%= to_celsius(day.temp.day) %>°
</div>
</div>


+ 7
- 0
apps/tomie_web/lib/tomie_web/views/page_view.ex View File

@@ -14,4 +14,11 @@ defmodule TomieWeb.PageView do
|> Enum.drop(1)
|> Enum.take(3)
end

def weekday(timestamp) do
timestamp
|> Timex.from_unix()
|> Timex.to_date()
|> Timex.format!("{WDshort}")
end
end

Loading…
Cancel
Save