Defect #37581 » format_hours.patch
lib/redmine/i18n.rb (working copy) | ||
---|---|---|
95 | 95 |
m = ((hours - h) * 60).round |
96 | 96 |
"%d:%02d" % [h, m] |
97 | 97 |
else |
98 |
"%.2f" % hours.to_f
|
|
98 |
sprintf("%.2f", hours.to_f).gsub('.', l(:"number.format.separator"))
|
|
99 | 99 |
end |
100 | 100 |
end |
101 | 101 |
test/helpers/application_helper_test.rb (working copy) | ||
---|---|---|
2152 | 2152 |
assert_equal '0:45 hour', l_hours(0.75) |
2153 | 2153 |
end |
2154 | 2154 |
with_settings :timespan_format => 'decimal' do |
2155 |
assert_equal '0.75', format_hours(0.75) |
|
2156 |
assert_equal '0.75 h', l_hours_short(0.75) |
|
2157 |
assert_equal '0.75 hour', l_hours(0.75) |
|
2155 |
time = '0.75'.gsub('.', l(:"number.format.separator")) |
|
2156 |
assert_equal time, format_hours(0.75) |
|
2157 |
assert_equal "#{time} h", l_hours_short(0.75) |
|
2158 |
assert_equal "#{time} hour", l_hours(0.75) |
|
2158 | 2159 |
end |
2159 | 2160 |
end |
2160 | 2161 |