See #170: subscriptions management UI

This commit is contained in:
Eliot Berriot 2020-03-23 10:44:09 +01:00
parent 926a5cfc83
commit be067b9ee3
13 changed files with 414 additions and 185 deletions

View file

@ -38,12 +38,38 @@ export function ago (date, locale) {
lastDay: 'L',
lastWeek: 'L',
sameElse: 'L'
})
})
}
Vue.filter('ago', ago)
export function fromNow (date, locale) {
locale = 'en'
moment.locale('en', {
relativeTime: {
future: 'in %s',
past: '%s ago',
s: 'seconds',
ss: '%ss',
m: 'a minute',
mm: '%dm',
h: 'an hour',
hh: '%dh',
d: 'a day',
dd: '%dd',
M: 'a month',
MM: '%dM',
y: 'a year',
yy: '%dY'
}
});
const m = moment(date)
m.locale(locale)
return m.fromNow(true)
}
Vue.filter('fromNow', fromNow)
export function secondsToObject (seconds) {
let m = moment.duration(seconds, 'seconds')
return {