Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
786ae683
Commit
786ae683
authored
Oct 01, 2018
by
Winnie Hellmann
Committed by
Alessio Caiazza
Oct 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not omit leading zeros in duration_in_numbers helper
parent
6369ff1c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
9 deletions
+5
-9
app/helpers/time_helper.rb
app/helpers/time_helper.rb
+1
-5
spec/helpers/time_helper_spec.rb
spec/helpers/time_helper_spec.rb
+4
-4
No files found.
app/helpers/time_helper.rb
View file @
786ae683
...
...
@@ -27,11 +27,7 @@ module TimeHelper
minutes
=
(
duration_in_seconds
/
1
.
minute
)
%
(
1
.
hour
/
1
.
minute
)
hours
=
duration_in_seconds
/
1
.
hour
if
hours
==
0
"%02d:%02d"
%
[
minutes
,
seconds
]
else
"%02d:%02d:%02d"
%
[
hours
,
minutes
,
seconds
]
end
else
time_format
=
duration_in_seconds
<
1
.
hour
?
"%M:%S"
:
"%H:%M:%S"
...
...
spec/helpers/time_helper_spec.rb
View file @
786ae683
...
...
@@ -39,10 +39,10 @@ describe TimeHelper do
context
"with allow_overflow = true"
do
where
(
:duration
,
:formatted_string
)
do
0
|
"00:00"
1
.
second
|
"00:01"
42
.
seconds
|
"00:42"
2
.
minutes
+
1
.
second
|
"02:01"
0
|
"00:00
:00
"
1
.
second
|
"00:0
0:0
1"
42
.
seconds
|
"00:
00:
42"
2
.
minutes
+
1
.
second
|
"0
0:0
2:01"
3
.
hours
+
2
.
minutes
+
1
.
second
|
"03:02:01"
30
.
hours
|
"30:00:00"
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment