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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
f66cffc8
Commit
f66cffc8
authored
Nov 01, 2019
by
jakeburden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Export getTimeago func to return timeago
parent
6401db89
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
app/assets/javascripts/lib/utils/datetime_utility.js
app/assets/javascripts/lib/utils/datetime_utility.js
+3
-4
No files found.
app/assets/javascripts/lib/utils/datetime_utility.js
View file @
f66cffc8
...
...
@@ -156,13 +156,14 @@ const memoizedLocale = () => {
timeago
.
register
(
timeagoLanguageCode
,
memoizedLocale
());
timeago
.
register
(
`
${
timeagoLanguageCode
}
-remaining`
,
memoizedLocaleRemaining
());
export
const
getTimeago
=
()
=>
timeago
;
/**
* For the given elements, sets a tooltip with a formatted date.
* @param {JQuery} $timeagoEls
* @param {Boolean} setTimeago
*/
export
const
localTimeAgo
=
(
$timeagoEls
,
setTimeago
=
true
)
=>
{
$timeagoEls
.
each
((
i
,
el
)
=>
{
$
(
el
).
text
(
timeago
.
format
(
$
(
el
).
attr
(
'
datetime
'
),
timeagoLanguageCode
));
});
...
...
@@ -196,9 +197,7 @@ export const timeFor = (time, expiredLabel) => {
if
(
new
Date
(
time
)
<
new
Date
())
{
return
expiredLabel
||
s__
(
'
Timeago|Past due
'
);
}
return
timeago
.
format
(
time
,
`
${
timeagoLanguageCode
}
-remaining`
)
.
trim
();
return
timeago
.
format
(
time
,
`
${
timeagoLanguageCode
}
-remaining`
).
trim
();
};
export
const
getDayDifference
=
(
a
,
b
)
=>
{
...
...
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