Formats the given seconds into a human-readable time string (HH:MM:SS or MM:SS)
Optionalseconds: number | nullthe number of seconds to format
whether to always include the hour part even when it is zero (defaults to false)
the formatted time string, e.g. "03:45" or "01:02:03", or undefined if seconds is absent
formatSeconds(36); // "00:36"
formatSeconds(125); // "02:05"
formatSeconds(3661); // "01:01:01"
formatSeconds(36, true); // "00:00:36"
formatSeconds(125, true); // "00:02:05"
formatSeconds(-1); // "00:00"
formatSeconds(Infinity); // "00:00"
formatSeconds(); // undefined
formatSeconds(undefined); // undefined
formatSeconds(null); // undefined
Utilities for duration
Author
David Hsing