format-time

format-time.js

Methods

static resetFormatTime()

Resets formatTime to the default implementation.

static setFormatTime(customImplementation)

Replaces the default formatTime implementation with a custom implementation.

Parameters:
Name Type Description
customImplementation function

A function which will be used in place of the default formatTime implementation. Will receive the current time in seconds and the guide (in seconds) as arguments.

inner defaultImplementation(seconds, guide) → {string}

Format seconds as a time string, H:MM:SS or M:SS. Supplying a guide (in seconds) will force a number of leading zeros to cover the length of the guide.

Parameters:
Name Type Description
seconds number

Number of seconds to be turned into a string

guide number

Number (in seconds) to model the string after

Returns:
string -

Time formatted as H:MM:SS or M:SS