Show correct timezone in event-related emails

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-10-13 12:52:38 +02:00
parent cd89efa1e3
commit a9e36aaacb
46 changed files with 962 additions and 625 deletions

View File

@@ -74,7 +74,21 @@
<%= gettext "Start" %>
</td>
<td bgcolor="#ffffff" align="left">
<b><%= @event.begins_on |> datetime_tz_convert(@timezone) |> datetime_to_string(@locale) %></b>
<%= if @event.options.timezone == nil do %>
<b><%= @event.begins_on |> datetime_tz_convert(@timezone) |> datetime_to_string(@locale) %></b>
<% else %>
<span style="font-size: 14px;">
<%= if @event.options.timezone != @timezone do %>
<%# Event with different timezone than user %>
<b><%= @event.begins_on |> datetime_tz_convert(@event.options.timezone) |> datetime_to_string(@locale) %></b><br />
<%= gettext "🌐 %{timezone} %{offset}", timezone: @event.options.timezone, offset: @event.begins_on |> datetime_tz_convert(@event.options.timezone) |> Cldr.DateTime.Formatter.zone_gmt() %>
<% else %>
<%# Event with same timezone than user %>
<b><%= @event.begins_on |> datetime_tz_convert(@event.options.timezone) |> datetime_to_string(@locale) %></b><br />
<%= gettext "In your timezone (%{timezone} %{offset})", timezone: @event.options.timezone, offset: @event.begins_on |> datetime_tz_convert(@event.options.timezone) |> Cldr.DateTime.Formatter.zone_gmt() %>
<% end %>
</span>
<% end %>
</td>
</tr>
<% end %>