1 type DateMagnitude = 'day' | 'hour' | 'minute' | 'second';
18 minute: 'time.minutes',
19 second: 'time.seconds'
22 makeTimeReadable(time: number, magnitude: DateMagnitude): ReadableTime {
24 count: Math.floor(time / internals.magnitudes[magnitude]),
25 label: internals.labels[magnitude]
30 export const readableTime = function readableTime(time: number): ReadableTime {
32 case time >= internals.magnitudes.day:
33 return internals.makeTimeReadable(time, 'day');
34 case time >= internals.magnitudes.hour:
35 return internals.makeTimeReadable(time, 'hour');
36 case time >= internals.magnitudes.minute:
37 return internals.makeTimeReadable(time, 'minute');
39 return internals.makeTimeReadable(0, 'second');
41 return internals.makeTimeReadable(time, 'second');