Added expected finish charging localtime to teslamate site (#3646)

* Added expected finish charging localtime to teslamate site

* format text

* fixing indentation

* fixing indentation

* format text

* Remove UTC timezone and use the local timezone
This commit is contained in:
Nir Klinger
2024-02-02 10:08:46 +02:00
committed by GitHub
parent 3cc0102090
commit 00a704b394
2 changed files with 33 additions and 17 deletions

View File

@@ -149,6 +149,13 @@
)%></td>
</tr>
<%= if @summary.state == :charging and not is_nil(@summary.time_to_full_charge) do %>
<%
current_time = Timex.now()
finish_time = Timex.add(current_time, Timex.Duration.from_hours(@summary.time_to_full_charge))
local_timezone = Timex.Timezone.local()
local_finish_time = Timex.Timezone.convert(finish_time, local_timezone)
formatted_finish_time = Timex.format!(local_finish_time, "%Y-%m-%d %H:%M:%S", :strftime)
%>
<tr>
<td class="has-text-weight-medium"><%= gettext "Remaining Time" %></td>
<td><%=
@@ -158,6 +165,10 @@
|> Enum.join(", ")
%></td>
</tr>
<tr>
<td class="has-text-weight-medium"><%= gettext "Expected Finish Time" %></td>
<td><%= formatted_finish_time %></td>
</tr>
<% end %>
<%= unless is_nil(@summary.ideal_battery_range_km) do %>
<tr>