Skip to content

Commit

Permalink
add: elapsed
Browse files Browse the repository at this point in the history
  • Loading branch information
Valexr committed May 6, 2024
1 parent 8eef1e9 commit 76a7626
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,21 @@ function openDatepicker(input: HTMLInputElement) {
input.showPicker();
}

function elapsed(start: number) {
const diffDate = new Date(Date.now() - start);
return (
"Elapsed Time: Years: " +
(diffDate.getFullYear() - 1970) +
", Months: " +
diffDate.getMonth() +
", Days: " +
(diffDate.getDate() - 1) +
", Hours: " +
diffDate.getHours() +
", Minutes: " +
diffDate.getMinutes() +
", Seconds: " +
diffDate.getSeconds()
);
};

0 comments on commit 76a7626

Please sign in to comment.