Skip to content

Commit

Permalink
display: correctly show the time zone abbreviation
Browse files Browse the repository at this point in the history
  • Loading branch information
offbyone committed May 26, 2022
1 parent 92a58a6 commit fdae557
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,19 @@ def hugo_nom_deadline_long_form
$nomination_closed_at.strftime("%H:%M %p, Pacific Daylight Time (PDT, UTC-7) on %B %d, %Y")
end

def human_timezone(time_string, timezone)
time = time_string.in_time_zone(timezone)

if time.zone.match?(/^\w/)
time.zone
else
time.formatted_offset
end
end

def hugo_vote_deadline
$hugo_closed_at.strftime("%A %-d %B %Y, %H:%M %p %Z")
time_zone = human_timezone($hugo_closed_at.to_s, "Pacific Time (US & Canada)")
$hugo_closed_at.strftime("%A %-d %B %Y, %H:%M %p #{time_zone}")
end

def hugo_ballot_pub_month
Expand Down

0 comments on commit fdae557

Please sign in to comment.