1 export const formatTime = result => {
2 const hours = `${Math.floor(result.time / 60 / 60)}`;
3 let minutes = `${Math.floor((result.time / 60) % 60)}`;
4 let seconds = `${Math.floor(result.time % 60)}`;
5 while (minutes.length < 2) {
6 minutes = `0${minutes}`;
8 while (seconds.length < 2) {
9 seconds = `0${seconds}`;
11 return `${hours}:${minutes}:${seconds}`;
14 export const parseTime = str => {
15 if (!str) return null;
16 return `${str}`.split(/[-\.: ]+/).reduce((acc,time) => (60 * acc) + +time, 0);