]>
git.r.bdr.sh - rbdr/forum/blob - src/utils/readable_time.js
4476952057951e4f218e1f91ce52c3b0730d7185
11 minute: 'time.minutes',
12 second: 'time.seconds'
15 makeTimeReadable(time
, magnitude
) {
18 count: Math
.floor(time
/ internals
.magnitudes
[magnitude
]),
19 label: internals
.labels
[magnitude
]
24 export const readableTime
= function readableTime(time
) {
27 case time
>= internals
.magnitudes
.day:
28 return internals
.makeTimeReadable(time
, 'day');
29 case time
>= internals
.magnitudes
.hour:
30 return internals
.makeTimeReadable(time
, 'hour');
31 case time
>= internals
.magnitudes
.minute:
32 return internals
.makeTimeReadable(time
, 'minute');
34 return internals
.makeTimeReadable(0, 'second');
36 return internals
.makeTimeReadable(time
, 'second');