Project

General

Profile

Defect #37581 » format_hours.patch

Karel Pičman, 2022-08-23 09:22

View differences:

lib/redmine/i18n.rb (working copy)
m = ((hours - h) * 60).round
"%d:%02d" % [h, m]
else
"%.2f" % hours.to_f
sprintf("%.2f", hours.to_f).gsub('.', l(:"number.format.separator"))
end
end
test/helpers/application_helper_test.rb (working copy)
assert_equal '0:45 hour', l_hours(0.75)
end
with_settings :timespan_format => 'decimal' do
assert_equal '0.75', format_hours(0.75)
assert_equal '0.75 h', l_hours_short(0.75)
assert_equal '0.75 hour', l_hours(0.75)
time = '0.75'.gsub('.', l(:"number.format.separator"))
assert_equal time, format_hours(0.75)
assert_equal "#{time} h", l_hours_short(0.75)
assert_equal "#{time} hour", l_hours(0.75)
end
end
(3-3/9)