feat(streamer): react views ported from prototype with sse hooks
This commit is contained in:
parent
870a41a2f7
commit
e0d93b03ae
9 changed files with 672 additions and 0 deletions
14
streamer/src/views/shared/format.ts
Normal file
14
streamer/src/views/shared/format.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
export const fmtMs = (sec: number): string => {
|
||||
const m = Math.floor(sec / 60);
|
||||
const s = Math.floor(sec % 60);
|
||||
return `${m}:${s.toString().padStart(2, "0")}`;
|
||||
};
|
||||
|
||||
export const fmtClock = (d: Date): string =>
|
||||
`${d.getHours().toString().padStart(2, "0")}:${d.getMinutes().toString().padStart(2, "0")}`;
|
||||
|
||||
export const fmtClockSec = (d: Date): string =>
|
||||
`${fmtClock(d)}:${d.getSeconds().toString().padStart(2, "0")}`;
|
||||
|
||||
export const fmtJpDate = (d: Date): string =>
|
||||
`${d.getFullYear()}年${d.getMonth() + 1}月${d.getDate()}日`;
|
||||
Loading…
Add table
Add a link
Reference in a new issue