Skip to content
This repository has been archived by the owner on Dec 23, 2024. It is now read-only.

Commit

Permalink
Fixed few problems with calculating albums duration
Browse files Browse the repository at this point in the history
  • Loading branch information
Akasiek committed Mar 17, 2022
1 parent 156d964 commit 981d6cb
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@ const AlbumPageAsideTracks = ({ album }) => {
});

// Pass hour or minute if there is more than 60 minutes or seconds
hours = parseInt(hours + minutes / 60);
minutes = minutes % 60;
minutes = parseInt(minutes + seconds / 60);
seconds = seconds % 60;
hours = parseInt(hours + minutes / 60);
minutes = minutes % 60;

// Add leading zero if needed
if (hours / 10 <= 0) hours = "0" + String(hours);
if (minutes / 10 <= 0) minutes = "0" + String(minutes);
if (seconds / 10 <= 0) seconds = "0" + String(seconds);
if (parseInt(hours / 10) <= 0) hours = "0" + String(hours);
if (parseInt(minutes / 10) <= 0) minutes = "0" + String(minutes);
if (parseInt(seconds / 10) <= 0) seconds = "0" + String(seconds);

console.log(hours, minutes, seconds);

// Return as duration string
return `${hours}:${minutes}:${seconds}`;
Expand Down

0 comments on commit 981d6cb

Please sign in to comment.