14 lines
538 B
TypeScript
14 lines
538 B
TypeScript
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()}日`;
|