1234567891011121314151617181920212223242526 |
- export const TimeFormatting = (timeDifference) => {
-
- const day = Math.floor(timeDifference / 3600 / 24)
-
- const hr = Math.floor(timeDifference / 3600 % 24)
-
- const min = Math.floor(timeDifference / 60 % 60)
-
- const sec = Math.floor(timeDifference % 60)
- return {
- day: timeFormat(day),
- hour: timeFormat(hr),
- min: timeFormat(min),
- sec: timeFormat(sec)
- }
- }
- function timeFormat(param) {
- return param < 10 ? '0' + param : param
- }
|