2017-06-03 03:25:02 +08:00
|
|
|
const humanizeSeconds = (time) => {
|
2016-11-29 03:48:02 +08:00
|
|
|
const minutes = Math.floor(time / 60);
|
|
|
|
const seconds = time % 60;
|
|
|
|
return [
|
|
|
|
minutes,
|
|
|
|
seconds,
|
2017-10-06 20:50:01 +08:00
|
|
|
].map((x) => {
|
|
|
|
if (x < 10) {
|
|
|
|
return `0${x}`;
|
|
|
|
}
|
|
|
|
return x;
|
|
|
|
},
|
|
|
|
).join(':');
|
2016-11-29 03:48:02 +08:00
|
|
|
};
|
|
|
|
|
2017-10-24 00:26:56 +08:00
|
|
|
export default humanizeSeconds;
|