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
Léo-Paul Géneau
gitlab-ce
Commits
95ddfc93
Commit
95ddfc93
authored
Nov 30, 2017
by
Jose Ivan Vargas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleaned up date_time_formatters
parent
51a9797d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
17 deletions
+8
-17
app/assets/javascripts/monitoring/utils/date_time_formatters.js
...sets/javascripts/monitoring/utils/date_time_formatters.js
+8
-17
No files found.
app/assets/javascripts/monitoring/utils/date_time_formatters.js
View file @
95ddfc93
...
...
@@ -9,33 +9,24 @@ export const timeFormat = d3.time('%-I:%M%p');
export
const
dateFormatWithName
=
d3
.
time
(
'
%a, %b %-d
'
);
export
const
bisectDate
=
d3
.
bisector
(
d
=>
d
.
time
).
left
;
const
formatMillisecond
=
d3
.
time
(
'
.%L
'
);
const
formatSecond
=
d3
.
time
(
'
:%S
'
);
const
formatMinute
=
d3
.
time
(
'
%-I:%M
'
);
const
formatHour
=
d3
.
time
(
'
%-I %p
'
);
const
formatDay
=
d3
.
time
(
'
%a %d
'
);
const
formatWeek
=
d3
.
time
(
'
%b %d
'
);
const
formatMonth
=
d3
.
time
(
'
%B
'
);
const
formatYear
=
d3
.
time
(
'
%Y
'
);
export
function
timeScaleFormat
(
date
)
{
let
formatFunction
;
if
(
d3
.
timeSecond
(
date
)
<
date
)
{
formatFunction
=
formatMillisecond
;
formatFunction
=
d3
.
time
(
'
.%L
'
)
;
}
else
if
(
d3
.
timeMinute
(
date
)
<
date
)
{
formatFunction
=
formatSecond
;
formatFunction
=
d3
.
time
(
'
:%S
'
)
;
}
else
if
(
d3
.
timeHour
(
date
)
<
date
)
{
formatFunction
=
formatMinute
;
formatFunction
=
d3
.
time
(
'
%-I:%M
'
)
;
}
else
if
(
d3
.
timeDay
(
date
)
<
date
)
{
formatFunction
=
formatHour
;
formatFunction
=
d3
.
time
(
'
%-I %p
'
)
;
}
else
if
(
d3
.
timeWeek
(
date
)
<
date
)
{
formatFunction
=
formatDay
;
formatFunction
=
d3
.
time
(
'
%a %d
'
)
;
}
else
if
(
d3
.
timeMonth
(
date
)
<
date
)
{
formatFunction
=
formatWeek
;
formatFunction
=
d3
.
time
(
'
%b %d
'
)
;
}
else
if
(
d3
.
timeYear
(
date
)
<
date
)
{
formatFunction
=
formatMonth
;
formatFunction
=
d3
.
time
(
'
%B
'
)
;
}
else
{
formatFunction
=
formatYear
;
formatFunction
=
d3
.
time
(
'
%Y
'
)
;
}
return
formatFunction
(
date
);
}
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