Formatters

formatTimeRange.mjs

@mr_ozio/scraper-utils · v2.5.0 · Generated April 21, 2026

Target Style

Target Style

1 exports

const

formatDuration

Target Style
export const formatDuration = (range, { includeMilliseconds = false } = {}) => {

Formats a duration in milliseconds using named options.

Target style API. Preferred for new code.

Parameters

  • rangenumber
  • [options]{ includeMilliseconds?: boolean }

Returns

string

Legacy Style

Legacy Style

1 exports

const

formatTimeRange

Legacy Style
export const formatTimeRange = (range, withMS) => formatDuration(range, { includeMilliseconds: Boolean(withMS) })

Formats a duration in milliseconds into a compact human-readable string.

Legacy API. Kept for older code and not the preferred choice for new code.

Parameters

  • rangenumber
  • [withMS=false]boolean

Returns

string