Spaces:
Configuration error
Configuration error
Download frontend/src/utils/format-ms.ts from flyingdarkdev/README: direct link, hf CLI and curl.
- Browser
- Download file 497 Bytes
-
https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/utils/format-ms.ts
- Command line
-
hf download hf://spaces/flyingdarkdev/README/frontend/src/utils/format-ms.ts
-
curl -L -o format-ms.ts https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/utils/format-ms.ts
497 Bytes
| /** | |
| * Formats a time in milliseconds to the format "mm:ss" | |
| * @param ms The time in milliseconds | |
| * @returns The formatted time in the format "mm:ss" | |
| * | |
| * @example | |
| * formatMs(1000) // "00:01" | |
| * formatMs(1000 * 60) // "01:00" | |
| * formatMs(1000 * 60 * 2.5) // "02:30" | |
| */ | |
| export const formatMs = (ms: number) => { | |
| const minutes = Math.floor(ms / 1000 / 60); | |
| const seconds = Math.floor((ms / 1000) % 60); | |
| return `${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`; | |
| }; | |