A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
fix: to time span does not support future dates
aminnausinc23846e03313
diff --git a/resources/js/service/util.ts b/resources/js/service/util.tsindex e32628ef..c946bdc5 100644--- a/resources/js/service/util.ts+++ b/resources/js/service/util.ts@@ -11,7 +11,9 @@ export function toTimeSpan(rawDate: Date | string, timeZoneName = ' EST', short?if (typeof rawDate === 'string') {rawDate = new Date(rawDate + timeZoneName);}- const rawAge = Date.now() - rawDate.getTime();++ const timeDiff = Date.now() - rawDate.getTime();+ const rawAge = Math.abs(timeDiff);const weeks = Math.floor(rawAge / (1000 * 3600 * 24 * 7));const days = Math.floor(rawAge / (1000 * 3600 * 24));@@ -39,8 +41,9 @@ export function toTimeSpan(rawDate: Date | string, timeZoneName = ' EST', short?timeSpan = `${Math.max(1, seconds)}s`;}- if (!short) timeSpan += ' ago';- return timeSpan;+ if (short) return timeSpan;++ return timeDiff < 0 ? `in ${timeSpan}` : `${timeSpan} ago`;}export function toFormattedDate(