[javascript] Format seconds as a time string