Skip to content

Commit 42c245c

Browse files
skjnldsvnextcloud-command
authored andcommitted
fix(files): ensure valid mtime and fallback to crtime if defined
Signed-off-by: skjnldsv <[email protected]>
1 parent c3c6a75 commit 42c245c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

apps/files/src/components/FileEntry.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767
class="files-list__row-mtime"
6868
data-cy-files-list-row-mtime
6969
@click="openDetailsIfAvailable">
70-
<NcDateTime v-if="source.mtime" :timestamp="source.mtime" :ignore-seconds="true" />
70+
<NcDateTime v-if="mtime" :timestamp="mtime" :ignore-seconds="true" />
71+
<span v-else>{{ t('files', 'Unknown date') }}</span>
7172
</td>
7273

7374
<!-- View columns -->
@@ -204,6 +205,19 @@ export default defineComponent({
204205
}
205206
},
206207
208+
mtime() {
209+
// If the mtime is not a valid date, return it as is
210+
if (this.source.mtime && !isNaN(this.source.mtime.getDate())) {
211+
return this.source.mtime
212+
}
213+
214+
if (this.source.crtime && !isNaN(this.source.crtime.getDate())) {
215+
return this.source.crtime
216+
}
217+
218+
return null
219+
},
220+
207221
mtimeTitle() {
208222
if (this.source.mtime) {
209223
return moment(this.source.mtime).format('LLL')

0 commit comments

Comments
 (0)