Browse Source

improvement: iproved total playlist length in playlist items and elsewhere

Kristian Vos 3 years ago
parent
commit
e4eb4fc575
2 changed files with 8 additions and 17 deletions
  1. 6 15
      frontend/js/utils.js
  2. 2 2
      frontend/src/components/PlaylistItem.vue

+ 6 - 15
frontend/js/utils.js

@@ -43,11 +43,8 @@ export default {
 		const hours = Math.floor(duration / (60 * 60));
 		const formatHours = () => {
 			if (hours > 0) {
-				if (hours > 1) {
-					if (hours < 10) return `0${hours} hours `;
-					return `${hours} hours `;
-				}
-				return `0${hours} hour `;
+				if (hours > 1) return `${hours} hours `;
+				return `${hours} hour `;
 			}
 			return "";
 		};
@@ -55,11 +52,8 @@ export default {
 		const minutes = Math.floor((duration - hours * 60 * 60) / 60);
 		const formatMinutes = () => {
 			if (minutes > 0) {
-				if (minutes > 1) {
-					if (minutes < 10) return `0${minutes} minutes `;
-					return `${minutes} minutes `;
-				}
-				return `0${minutes} minute `;
+				if (minutes > 1) return `${minutes} minutes `;
+				return `${minutes} minute `;
 			}
 			return "";
 		};
@@ -67,11 +61,8 @@ export default {
 		const seconds = Math.floor(duration - hours * 60 * 60 - minutes * 60);
 		const formatSeconds = () => {
 			if (seconds > 0) {
-				if (seconds > 1) {
-					if (seconds < 10) return `0${seconds} seconds `;
-					return `${seconds} seconds `;
-				}
-				return `0${seconds} second `;
+				if (seconds > 1) return `${seconds} seconds `;
+				return `${seconds} second `;
 			}
 			return "";
 		};

+ 2 - 2
frontend/src/components/PlaylistItem.vue

@@ -23,8 +23,8 @@
 						:user-id="playlist.createdBy"
 						:link="true"
 					/>
-					•</span
-				>
+					•
+				</span>
 				<span :title="playlistLength">
 					{{ playlistLength }}
 				</span>