From fdbb68a3c3aa6c6cf6ae5c440dd7b742076f1184 Mon Sep 17 00:00:00 2001 From: Robin McCorkell Date: Fri, 5 Dec 2014 13:54:43 +0000 Subject: Return ? if mtime is 0 or -1 Tooltip contains 'Unable to determine date'. Fixes #6395 --- apps/files/js/filelist.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'apps/files/js') diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 6ffc10cdcbd..f4b45fc58bf 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -637,12 +637,16 @@ icon = OC.Util.replaceSVGIcon(fileData.icon), name = fileData.name, type = fileData.type || 'file', - mtime = parseInt(fileData.mtime, 10) || new Date().getTime(), + mtime = parseInt(fileData.mtime, 10), mime = fileData.mimetype, path = fileData.path, linkUrl; options = options || {}; + if (isNaN(mtime)) { + mtime = new Date().getTime() + } + if (type === 'dir') { mime = mime || 'httpd/unix-directory'; } @@ -753,12 +757,21 @@ if (modifiedColor >= '160') { modifiedColor = 160; } + var formatted; + var text; + if (mtime > 0) { + formatted = formatDate(mtime); + text = OC.Util.relativeModifiedDate(mtime); + } else { + formatted = t('files', 'Unable to determine date'); + text = '?'; + } td = $('').attr({ "class": "date" }); td.append($('').attr({ "class": "modified", - "title": formatDate(mtime), + "title": formatted, "style": 'color:rgb('+modifiedColor+','+modifiedColor+','+modifiedColor+')' - }).text(OC.Util.relativeModifiedDate(mtime))); + }).text(text)); tr.find('.filesize').text(simpleSize); tr.append(td); return tr; -- cgit v1.2.3