platform
    Preparing search index...

    Function formatDuration

    • 초를 한글 형식의 소요시간 문자열로 변환 시간, 분, 초 단위로 표현 (0인 단위는 생략)

      Parameters

      • second: number

        변환할 초 (소수점은 버림)

      Returns string

      한글 형식의 소요시간 문자열 (NaN인 경우 '-', 0 이하인 경우 '0초')

      formatDuration(90) // '1분 30초'
      formatDuration(3661) // '1시간 1분 1초'
      formatDuration(45) // '45초'
      formatDuration(7200) // '2시간'
      formatDuration(NaN) // '-'
      formatDuration(0) // '0초'
      formatDuration(-10) // '0초'