Skip to content

Commit

Permalink
[webui] Use I18n to show DateTime
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisBr committed Jul 28, 2017
1 parent c7e6a7c commit 245a24a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/api/app/helpers/webui/webui_helper.rb
Expand Up @@ -45,7 +45,7 @@ def fuzzy_time(time, with_fulltime = true)
human_time_ago = time_ago_in_words(time) + ' ago'

if with_fulltime
raw("<span title='#{time.utc.strftime('%Y-%m-%d %H:%M UTC')}' class='fuzzy-time'>#{human_time_ago}</span>")
raw("<span title='#{l time.utc}' class='fuzzy-time'>#{human_time_ago}</span>")
else
human_time_ago
end
Expand Down
6 changes: 3 additions & 3 deletions src/api/app/views/webui/request/show.html.erb
Expand Up @@ -51,9 +51,9 @@
<% if @accept_at -%>
<li><%= sprite_tag('exclamation', title: '') %>
<% if BsRequest::FINAL_REQUEST_STATES.include?(@state) %>
The request auto-accept was set to
<span title='<%= @accept_at.utc.strftime('%Y-%m-%d %H:%M UTC') %>' class='fuzzy-time'>
<%= @accept_at.utc.strftime('%Y-%m-%d') %>.
Auto-accept was set to
<span title='<%= l @accept_at %>' class='fuzzy-time'>
<%= l @accept_at, format: :only_date %>.
</span>
<% elsif @accept_at.past? %>
This request will be automatically accepted when it enters the 'new' state.
Expand Down
5 changes: 4 additions & 1 deletion src/api/config/locales/en.yml
Expand Up @@ -20,4 +20,7 @@
# available at http://guides.rubyonrails.org/i18n.html.

en:
hello: "Hello world"
time:
formats:
only_date: '%Y-%m-%d'
default: '%Y-%m-%d %H:%M UTC'

0 comments on commit 245a24a

Please sign in to comment.