]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(files): ensure valid mtime and fallback to crtime if defined
authorskjnldsv <skjnldsv@protonmail.com>
Tue, 12 Nov 2024 10:30:13 +0000 (11:30 +0100)
committernextcloud-command <nextcloud-command@users.noreply.github.com>
Thu, 14 Nov 2024 13:32:37 +0000 (13:32 +0000)
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
apps/files/src/components/FileEntry.vue

index 659e068e08b4cea32a648d9e39394e6be459d7b6..f6f93be1dc8cbeec11cdf03b6ae78e54b77ecce1 100644 (file)
@@ -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')