diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-09-23 18:34:30 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-09-23 18:34:30 +0200 |
| commit | e2c13867baf66a6ae22c975563f8755e782d07a9 (patch) | |
| tree | fa7c51a6a6628a5b1e1173c6cd1a381ff15cc500 /app/client/util/format.js | |
| parent | f3885f7d43dffe4e0fcf49e3e8f9f9e248bc6f76 (diff) | |
adding timeline component
Diffstat (limited to 'app/client/util/format.js')
| -rw-r--r-- | app/client/util/format.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/client/util/format.js b/app/client/util/format.js index ee1f47f..2c94de1 100644 --- a/app/client/util/format.js +++ b/app/client/util/format.js @@ -1,3 +1,13 @@ +const FRAME_RATE = 25 +export function frameTimestamp(n = 0) { + n /= FRAME_RATE + let s = pad((n % 60).toFixed(1)) + n = Math.floor(n / 60) + if (n > 60) { + return Math.floor(n / 60) + ':' + pad(n % 60) + ':' + s + } + return (n % 60) + ':' + s +} export function timeInSeconds(n){ return (n / 10).toFixed(1) + ' s.' } @@ -144,3 +154,4 @@ export function get_age (t) { return r(age) + "y" } export function courtesy_s (n, s) { return n == 1 ? "" : (s || "s") } +export function pad(n, r){ return n < 10 ? '0' + n : n } |
