fix: wrong timestamp displayed when no timestamp available

Massimo Melina committed Jan 10, 2022 at 15:01 UTC 75d49e192aea539621f86976a283ad023eba9e26
2 files changed +3 -2
frontend/src/BrowseFiles.ts
+1 -1
@@ -12,7 +12,7 @@ export function usePath() {
12 }
13
14 export interface DirEntry { n:string, s?:number, m?:string, c?:string,
15 - ext:string, isFolder:boolean, t:Date } // we memoize these value for speed
15 + ext:string, isFolder:boolean, t?:Date } // we memoize these value for speed
16 export type DirList = DirEntry[]
17 interface ListRes { list:DirList, loading?:boolean, err?:Error, reload?:()=>void }
18
frontend/src/useFetchList.ts
+2 -1
@@ -112,7 +112,8 @@ function precalculate(rec:DirEntry) {
112 rec.ext = i ? rec.n.substring(i) : ''
113 rec.isFolder = rec.n.endsWith('/')
114 const t = rec.m || rec.c
115 - rec.t = new Date(t||0)
115 + if (t)
116 + rec.t = new Date(t)
117 return rec
118 }
119