Skip to content

Commit

Permalink
Convert time stored in UTC to local timezone for picker
Browse files Browse the repository at this point in the history
form.datetime_field uses html input `datetime-local` under the hood, which does not factor in
timezones, so convert it here explicitly
  • Loading branch information
albertchae committed May 31, 2024
1 parent 315e471 commit 2138b30
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/banners/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</div>
<span class="input-style-1">
<%= form.label :expires_at, "Expires at (optional)" %>
<%= form.datetime_field :expires_at, required: false %>
<%= form.datetime_field :expires_at, value: banner.expires_at&.in_time_zone(cookies[:browser_time_zone]), required: false %>
</span>
<div class="input-style-1">
<%= form.label :content %>
Expand Down

0 comments on commit 2138b30

Please sign in to comment.