summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2018-10-22 08:59:16 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2018-10-22 08:59:16 +0000
commitfdcdc36eecdbe904cf80fa130aebf4edd34c3f12 (patch)
tree3f1e1e8ca07448d4e5ac22b53e359be4a907bea4 /app/helpers
parentb5dfa745800a38cc17cadc0aa49a933713bdc1a5 (diff)
parentfb685031d8c60ca1d8f607c569cd519875e873c9 (diff)
downloadgitlab-ce-fdcdc36eecdbe904cf80fa130aebf4edd34c3f12.tar.gz
Merge branch 'drop-allow_overflow-option-duration_in_numbers' into 'master'
Drop allow overflow option duration in numbers Closes #52284 See merge request gitlab-org/gitlab-ce!22246
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/time_helper.rb16
1 files changed, 7 insertions, 9 deletions
diff --git a/app/helpers/time_helper.rb b/app/helpers/time_helper.rb
index 3e6a301b77d..719c351242c 100644
--- a/app/helpers/time_helper.rb
+++ b/app/helpers/time_helper.rb
@@ -21,17 +21,15 @@ module TimeHelper
"#{from.to_s(:short)} - #{to.to_s(:short)}"
end
- def duration_in_numbers(duration_in_seconds, allow_overflow = false)
- if allow_overflow
- seconds = duration_in_seconds % 1.minute
- minutes = (duration_in_seconds / 1.minute) % (1.hour / 1.minute)
- hours = duration_in_seconds / 1.hour
+ def duration_in_numbers(duration_in_seconds)
+ seconds = duration_in_seconds % 1.minute
+ minutes = (duration_in_seconds / 1.minute) % (1.hour / 1.minute)
+ hours = duration_in_seconds / 1.hour
- "%02d:%02d:%02d" % [hours, minutes, seconds]
+ if hours == 0
+ "%02d:%02d" % [minutes, seconds]
else
- time_format = duration_in_seconds < 1.hour ? "%M:%S" : "%H:%M:%S"
-
- Time.at(duration_in_seconds).utc.strftime(time_format)
+ "%02d:%02d:%02d" % [hours, minutes, seconds]
end
end
end