diff options
author | Go MAEDA <maeda@farend.jp> | 2024-08-08 04:24:44 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2024-08-08 04:24:44 +0000 |
commit | c96ef014dd8405e70cc30c5da0f7cffc98a153d4 (patch) | |
tree | a814519a866ab9820e96130c894b81ae2f154ead /lib | |
parent | 2bc9048bb1db4f7bbc872fb1a4a1ce922ad5173e (diff) | |
download | redmine-c96ef014dd8405e70cc30c5da0f7cffc98a153d4.tar.gz redmine-c96ef014dd8405e70cc30c5da0f7cffc98a153d4.zip |
Fix issue where minutes part of a time entry is displayed as 60 instead of being carried over (#36897).
Patch by Go MAEDA (user:maeda).
git-svn-id: https://svn.redmine.org/redmine/trunk@22946 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r-- | lib/redmine/i18n.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/redmine/i18n.rb b/lib/redmine/i18n.rb index 83ecb05eb..0488fa289 100644 --- a/lib/redmine/i18n.rb +++ b/lib/redmine/i18n.rb @@ -92,12 +92,12 @@ module Redmine def format_hours(hours) return "" if hours.blank? + minutes = (hours * 60).round if Setting.timespan_format == 'minutes' - h = hours.floor - m = ((hours - h) * 60).round + h, m = minutes.divmod(60) "%d:%02d" % [h, m] else - number_with_delimiter(sprintf('%.2f', hours.to_f), delimiter: nil) + number_with_delimiter(sprintf('%.2f', minutes.fdiv(60)), delimiter: nil) end end |