Skip to content

A self-hosted media server and file management system

fix wrong durations in metaData

aminnausin54eaceba595a
diff --git a/resources/js/service/util.js b/resources/js/service/util.js
index ebc93cec..0cb2f8f4 100644
--- a/resources/js/service/util.js
+++ b/resources/js/service/util.js
@@ -24,11 +24,11 @@ export function toFormattedDate(rawDate) {
export function toFormattedDuration(rawSeconds) {
if(isNaN(parseInt(rawSeconds))) return null;
- const hours = Math.round(rawSeconds / (3600));
- const minutes = Math.round((rawSeconds % 3600) / (60));
- const seconds = Math.round(rawSeconds % 60);
+ const hours = Math.floor(rawSeconds / (3600));
+ const minutes = Math.floor((rawSeconds % 3600) / (60));
+ const seconds = Math.floor(rawSeconds % 60);
- const duration = `${hours > 0 ? `${hours}h `:' '}${minutes > 0 ? `${minutes}m `:' '}${`${formatInteger(seconds)}s`}`;
+ const duration = `${hours > 0 ? `${hours}h `:''}${minutes > 0 ? `${minutes}m `:''}${`${formatInteger(seconds)}s`}`;
return duration;
}