Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
funkwhale
funkwhale
Commits
6cfad078
Verified
Commit
6cfad078
authored
Mar 06, 2019
by
Eliot Berriot
Browse files
Use shorter format for ago dates
parent
666aaf01
Pipeline
#3457
passed with stages
in 2 minutes and 49 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
front/src/filters.js
View file @
6cfad078
...
...
@@ -17,7 +17,15 @@ export function ago (date, locale) {
locale
=
locale
||
'
en
'
const
m
=
moment
(
date
)
m
.
locale
(
locale
)
return
m
.
fromNow
()
return
m
.
calendar
(
null
,
{
sameDay
:
'
LT
'
,
nextDay
:
'
L
'
,
nextWeek
:
'
L
'
,
lastDay
:
'
L
'
,
lastWeek
:
'
L
'
,
sameElse
:
'
L
'
})
}
Vue
.
filter
(
'
ago
'
,
ago
)
...
...
front/tests/unit/specs/filters/filters.spec.js
View file @
6cfad078
import
{
expect
}
from
'
chai
'
import
moment
from
'
moment
'
import
{
truncate
,
ago
,
capitalize
,
year
}
from
'
@/filters
'
describe
(
'
filters
'
,
()
=>
{
...
...
@@ -24,7 +24,15 @@ describe('filters', () => {
it
(
'
works
'
,
()
=>
{
const
input
=
new
Date
()
let
output
=
ago
(
input
)
expect
(
output
).
to
.
equal
(
'
a few seconds ago
'
)
let
expected
=
moment
(
input
).
calendar
(
input
,
{
sameDay
:
'
LT
'
,
nextDay
:
'
L
'
,
nextWeek
:
'
L
'
,
lastDay
:
'
L
'
,
lastWeek
:
'
L
'
,
sameElse
:
'
L
'
})
expect
(
output
).
to
.
equal
(
expected
)
})
})
describe
(
'
year
'
,
()
=>
{
...
...
Write
Preview
Supports
Markdown
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