Skip to content

Commit cba4673

Browse files
authored
Merge pull request #49225 from nextcloud/fix/invalid-mtime
2 parents c3c6a75 + 394ca87 commit cba4673

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
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')

dist/files-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)