Commit 72d99983a3a8d6b333d24adfbc4d2ac9b4989b97
Committed by
Antonio Terceiro
1 parent
1a26c326
Exists in
master
and in
28 other branches
Time of comments now display the left zero of minutes
(ActionItem1691)
Showing
2 changed files
with
5 additions
and
1 deletions
Show diff stats
app/helpers/dates_helper.rb
@@ -36,7 +36,7 @@ module DatesHelper | @@ -36,7 +36,7 @@ module DatesHelper | ||
36 | # formats a datetime for displaying. | 36 | # formats a datetime for displaying. |
37 | def show_time(time) | 37 | def show_time(time) |
38 | if time | 38 | if time |
39 | - _('%{day} %{month} %{year}, %{hour}:%{minutes}') % { :year => time.year, :month => month_name(time.month), :day => time.day, :hour => time.hour, :minutes => time.min } | 39 | + _('%{day} %{month} %{year}, %{hour}:%{minutes}') % { :year => time.year, :month => month_name(time.month), :day => time.day, :hour => time.hour, :minutes => time.strftime("%M") } |
40 | else | 40 | else |
41 | '' | 41 | '' |
42 | end | 42 | end |
test/unit/dates_helper_test.rb
@@ -148,6 +148,10 @@ class DatesHelperTest < Test::Unit::TestCase | @@ -148,6 +148,10 @@ class DatesHelperTest < Test::Unit::TestCase | ||
148 | assert_equal '22 November 2008, 15:34', show_time(Time.mktime(2008, 11, 22, 15, 34, 0, 0)) | 148 | assert_equal '22 November 2008, 15:34', show_time(Time.mktime(2008, 11, 22, 15, 34, 0, 0)) |
149 | end | 149 | end |
150 | 150 | ||
151 | + should 'format time with 2 digits minutes' do | ||
152 | + assert_equal '22 November 2008, 15:04', show_time(Time.mktime(2008, 11, 22, 15, 04, 0, 0)) | ||
153 | + end | ||
154 | + | ||
151 | should 'translate time' do | 155 | should 'translate time' do |
152 | time = Time.parse('25 May 2009, 12:47') | 156 | time = Time.parse('25 May 2009, 12:47') |
153 | expects(:_).with('%{day} %{month} %{year}, %{hour}:%{minutes}').returns('translated time') | 157 | expects(:_).with('%{day} %{month} %{year}, %{hour}:%{minutes}').returns('translated time') |