Skip to content

Commit 8c2d9f3

Browse files
FormatTime function to submodule (#17)
* FormatTime function to submodule * PR comments
1 parent dcbd2e8 commit 8c2d9f3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

date-parser.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,10 @@ export function isValidDate(date: string) {
3232

3333
export function timeDiffCalc(dateA: any, dateB: any = Date.now()) {
3434
return new Date(Math.abs(dateB - dateA)).toISOString().substring(11, 19);
35+
}
36+
37+
export function formatTimeDigitalClock(s: number) {
38+
const mm = Math.floor(s / 60);
39+
const ss = s % 60;
40+
return `${String(mm).padStart(2, "0")}:${String(ss).padStart(2, "0")}`;
3541
}

0 commit comments

Comments
 (0)