Use dashes to format invalid times

If the number of seconds to be formatted is NaN or Infinity, use dashes to substitute for the digits.