diff --git a/components/apps/Browser/directoryIndex.ts b/components/apps/Browser/directoryIndex.ts index d8a15920..816955b3 100644 --- a/components/apps/Browser/directoryIndex.ts +++ b/components/apps/Browser/directoryIndex.ts @@ -8,7 +8,7 @@ export type DirectoryEntries = { description?: string; href: string; icon?: string; - modified?: Date; + modified?: number; size?: number; }; @@ -89,9 +89,9 @@ const formatSize = (size?: number): string => { return newNumber + (addTrailingZero ? ".0" : "") + units[power]; }; -const formatDate = (date?: Date): string => - date - ? getTZOffsetISOString(date.getTime()) +const formatDate = (timestamp?: number): string => + timestamp + ? getTZOffsetISOString(timestamp) .replace("T", " ") .split(".")[0] .slice(0, -3) diff --git a/components/apps/Browser/index.tsx b/components/apps/Browser/index.tsx index 4f750caf..81449c36 100644 --- a/components/apps/Browser/index.tsx +++ b/components/apps/Browser/index.tsx @@ -48,6 +48,7 @@ import { } from "utils/functions"; import { getInfoWithExtension, + getModifiedTime, getShortcutInfo, } from "components/system/Files/FileEntry/functions"; import { useSession } from "contexts/session"; @@ -173,18 +174,18 @@ const Browser: FC = ({ id }) => { } } - const stats = await stat( + const filePath = shortcutUrl && (await exists(shortcutUrl)) ? shortcutUrl - : href - ); + : href; + const stats = await stat(filePath); const isDir = stats.isDirectory(); return { description, href: isDir && shortcutUrl ? shortcutUrl : href, icon: isDir ? "folder" : undefined, - modified: stats.mtime, + modified: getModifiedTime(filePath, stats), size: isDir || shortcutUrl ? undefined : stats.size, }; }) @@ -229,9 +230,7 @@ const Browser: FC = ({ id }) => { } if (column === "M") { - return sortValue( - ({ modified }) => modified?.getTime() ?? 0 - ); + return sortValue(({ modified }) => modified ?? 0); } if (column === "D") {