diff options
author | skjnldsv <skjnldsv@protonmail.com> | 2024-11-12 11:30:13 +0100 |
---|---|---|
committer | skjnldsv <skjnldsv@protonmail.com> | 2024-11-12 11:30:13 +0100 |
commit | 915821a2f9a990542388c84ac7cc4ea9d5193740 (patch) | |
tree | 2eadb5a4bce948d345dd80668b9d1e7a2aecd956 | |
parent | 17659d327ac2d6d62405ca489fb0f1432c4e03e4 (diff) | |
download | nextcloud-server-fix/invalid-mtime.tar.gz nextcloud-server-fix/invalid-mtime.zip |
fix(files): ensure valid mtime and fallback to crtime if definedfix/invalid-mtime
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
-rw-r--r-- | apps/files/src/components/FileEntry.vue | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/apps/files/src/components/FileEntry.vue b/apps/files/src/components/FileEntry.vue index 659e068e08b..f6f93be1dc8 100644 --- a/apps/files/src/components/FileEntry.vue +++ b/apps/files/src/components/FileEntry.vue @@ -67,7 +67,8 @@ class="files-list__row-mtime" data-cy-files-list-row-mtime @click="openDetailsIfAvailable"> - <NcDateTime v-if="source.mtime" :timestamp="source.mtime" :ignore-seconds="true" /> + <NcDateTime v-if="mtime" :timestamp="mtime" :ignore-seconds="true" /> + <span v-else>{{ t('files', 'Unknown date') }}</span> </td> <!-- View columns --> @@ -204,6 +205,19 @@ export default defineComponent({ } }, + mtime() { + // If the mtime is not a valid date, return it as is + if (this.source.mtime && !isNaN(this.source.mtime.getDate())) { + return this.source.mtime + } + + if (this.source.crtime && !isNaN(this.source.crtime.getDate())) { + return this.source.crtime + } + + return null + }, + mtimeTitle() { if (this.source.mtime) { return moment(this.source.mtime).format('LLL') |