export const getTimes = (durationStr) => {
    const duration = durationStr ? parseInt(durationStr, 10) : 0
    const seconds = duration % 60
    const totalMinutes = Math.floor(duration / 60)
    const minutes = totalMinutes % 60
    const hours = Math.floor(totalMinutes / 60)
  
    const padS2 = (num) => String(num).padStart(2, '0')
    let days = 0
    if (hours > 24 || (hours === 24 && (minutes > 0 || seconds > 0))) {
      days = Math.floor(hours / 24)
    }
    return {
      days: padS2(days),
      hours: padS2(hours - days * 24),
      minutes: padS2(minutes),
      seconds: padS2(seconds)
    }
}