Merge pull request #49284 from nextcloud/backport/49225/stable30

[stable30] fix(files): ensure valid mtime and fallback to crtime if defined
This commit is contained in:
Andy Scherzinger 2025-02-04 15:07:44 +01:00 committed by GitHub
commit 6cac474944
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 4 deletions

View 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')

4
dist/files-main.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long